Examples of flip()


Examples of java.nio.ByteBuffer.flip()

    handshake.put( (byte)0 );
    handshake.put( mapped_ip.getBytes() );
    handshake.put( (byte)0 );

    handshake.flip();
    
    return new ByteBuffer[] { handshake, ByteBuffer.allocate( 8 ) };   //TODO convert to direct?
  }
 
 
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

      handshake.put( (byte)5 ); // socks 5
      handshake.put( (byte)2 ); // 2 methods
      handshake.put( (byte)0 ); // no auth
      handshake.put( (byte)2 ); // user/pw

      handshake.flip();
      socks5_handshake_phase = 1;

      return new ByteBuffer[] { handshake, ByteBuffer.allocate( 2 ) };   //TODO convert to direct?
    }
   
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

      handshake.put( (byte)socks_user.length() ); // user length
      handshake.put( socks_user.getBytes() );
      handshake.put( (byte)socks_password.length() ); // password length
      handshake.put( socks_password.getBytes() );

      handshake.flip();
      socks5_handshake_phase = 2;

      return new ByteBuffer[] { handshake, ByteBuffer.allocate( 2 ) };   //TODO convert to direct?
    }
   
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

        handshake.put( mapped_ip.getBytes() );
      }

      handshake.putShort( (short)remote_address.getPort() ); // port
     
      handshake.flip();
      socks5_handshake_phase = 3;

      return new ByteBuffer[] { handshake, ByteBuffer.allocate( 5 ) };   //TODO convert to direct?
    }
   
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

       
        //  test the XML file by displaying the first 1024 characters
      FileChannel fc = fisXML.getChannel();
      ByteBuffer buf = ByteBuffer.allocate((int)fc.size());
      fc.read(buf);
      buf.flip();
  //      while(buf.hasRemaining())
  //        System.out.print((char)buf.get());
  //      fisXML.close();
  //      System.out.print('\n');
 
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

   */
  public static ByteOrder checkFormat(ReadableByteChannel in)
      throws IOException {
    ByteBuffer b = ByteBuffer.allocate(4);
    in.read(b);
    b.flip();

    if (PcapFile.headerReader.readType(b) != RecordType.BlockRecord) {
      return null;
    }

View Full Code Here

Examples of java.nio.ByteBuffer.flip()

      if(i%2==0){
        System.out.println("write "+m.write(in,0,in.length-(i%3)));
      }
      else{
        bin.put(in,0,in.length-(i%3));
        bin.flip();
        System.out.println("write buffer"+m.write(bin));
        bin.clear();
      }
      for(int j=0;j<in.length;j++){
        in[j]++;
View Full Code Here

Examples of java.nio.CharBuffer.flip()

        CharBuffer dest = CharBuffer.
            allocate(10 + (int)(inbuf.remaining()*factor));

        while (true) {
            CoderResult result = decoder.decode(inbuf, dest, true);
            dest.flip();

            if (result.isUnderflow()) { // done reading
                // make sure there is at least one extra character
                if (dest.limit() == dest.capacity()) {
                    dest = CharBuffer.allocate(dest.capacity()+1).put(dest);
View Full Code Here

Examples of java.nio.DoubleBuffer.flip()

    DoubleBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.clear();
    int saved_position = buffer.position();
    direct_buffer.put(buffer);
    buffer.position(saved_position);
    direct_buffer.flip();
    return direct_buffer;
  }

  private static final class CachedBuffers {
    private final ByteBuffer byte_buffer;
View Full Code Here

Examples of java.nio.FloatBuffer.flip()

    FloatBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.clear();
    int saved_position = buffer.position();
    direct_buffer.put(buffer);
    buffer.position(saved_position);
    direct_buffer.flip();
    return direct_buffer;
  }

  private static IntBuffer lookupBuffer(IntBuffer buffer) {
    CachedBuffers buffers = getCachedBuffers(buffer.remaining()*4);
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.