Examples of flip()


Examples of java.nio.ByteBuffer.flip()

        initial_outbound_data.put( ddb.getBuffer( DirectByteBuffer.SS_PEER ));

        ddb.returnToPool();
      }

      initial_outbound_data.flip();

      handshake_sent = true;
    }

    int  priority;
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

  private void broadcast (int udpPort, DatagramSocket socket) throws IOException {
    int classID = kryo.getRegisteredClass(DiscoverHost.class).getID();
    ByteBuffer dataBuffer = ByteBuffer.allocate(4);
    IntSerializer.put(dataBuffer, classID, true);
    dataBuffer.flip();
    byte[] data = new byte[dataBuffer.limit()];
    dataBuffer.get(data);
    for (NetworkInterface iface : Collections.list(NetworkInterface.getNetworkInterfaces())) {
      for (InetAddress address : Collections.list(iface.getInetAddresses())) {
        if (!address.isSiteLocalAddress()) continue;
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

      ByteBuffer msg = ByteBuffer.allocate( 4 + map_bytes.length );

      msg.putInt( map_bytes.length );
      msg.put( map_bytes );

      msg.flip();
     
      return( msg );
    }
   
    public void runSupport() {
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

      try{
        ByteBuffer  buffer = ByteBuffer.allocate( 32*1024 );
           
        sts_engine.getKeys( buffer );
           
        buffer.flip();
       
        sent_keys = true;
       
        connection.connect( buffer );
       
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

            try{
              long  len = filter.read( new ByteBuffer[]{ buffer }, 0, 1 );
           
              byte[]  data = new byte[buffer.position()];
             
              buffer.flip();
             
              buffer.get( data );
             
              System.out.println( str + ": " + new String(data));
             
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

    if ( payload_buffer != null ) {
      payload_buffer.flip( SS );
      unused.put( payload_buffer.getBuffer( SS ) ); // Got a buffer overflow exception here in the past - related to PEX?
    }
   
    unused.flip();

    length_buffer.returnToPool();
   
    if( payload_buffer != null ) {
      payload_buffer.returnToPool();
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

       
        rem--;
       
        protocol_bytes_read++;
       
        bb.flip();
       
        char  c = (char)(bytes[0]&0xff);
       
        header_so_far.append( c );
       
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

    ByteBuffer 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 ShortBuffer lookupBuffer(ShortBuffer buffer) {
    CachedBuffers buffers = getCachedBuffers(buffer.remaining()*2);
 
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

        byte[] data = ((DataBufferByte) texImage.getRaster().getDataBuffer()).getData();

        imageBuffer = ByteBuffer.allocateDirect(data.length);
        imageBuffer.order(ByteOrder.nativeOrder());
        imageBuffer.put(data, 0, data.length);
        imageBuffer.flip();

        return imageBuffer;
    }

    /**
 
View Full Code Here

Examples of java.nio.ByteBuffer.flip()

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

    handshake.put( (byte)0 );
   
    handshake.flip();
  
    return new ByteBuffer[] { handshake, ByteBuffer.allocate( 8 ) };     //TODO convert to direct?
  }
 
 
View Full Code Here
TOP
Copyright © 2015 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.