Examples of remaining()


Examples of java.nio.ByteBuffer.remaining()

  private void writeString(String s, DataOutputStream dataOut)
    throws IOException
  {
    ByteBuffer byteBuf = charsetEncoder.encode(CharBuffer.wrap(s));
    dataOut.writeInt(byteBuf.remaining());
    dataOut.write(byteBuf.array(), 0, byteBuf.remaining());
  }

  private String readString(DataInputStream dataIn)
    throws IOException
  {
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

    do {
      ByteBuffer transferBuffer = ByteBuffer.allocate(chunkSize);
      read = bodyDatasource.read(transferBuffer);

      if (read > 0) {
        if (transferBuffer.remaining() == 0) {
          transferBuffer.flip();
          buffers.add(transferBuffer);

        } else {
          transferBuffer.flip();
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

   
    int read = 0;
   
    for (int i = bufferIdx; i < buffers.size(); i++) {
      ByteBuffer buffer = buffers.get(i);
      read += buffer.remaining();
     
      bufferSink.add(buffer);
    }
   
    clear();
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

     
      byte cmdtype = contentbuf.get();
      long playerId = contentbuf.getLong();
      int validateCode = contentbuf.getInt();
     
      byte[] body = new byte[contentbuf.remaining()];
      contentbuf.get(body);
     
      InputMessage msg = new InputMessage(cmdtype, playerId, validateCode, body);
     
      if(list == null) {
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

     
      byte cmdtype = contentBuffer.get();
      long playerId = contentBuffer.getLong();
      int validateCode = contentBuffer.getInt();
     
      byte[] msgbody = new byte[contentBuffer.remaining()];
     
      contentBuffer.get(msgbody);
     
      InputMessage msg = new InputMessage(cmdtype,playerId, validateCode, msgbody);
     
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

  private void writeString(String s)
    throws IOException
  {
    ByteBuffer byteBuf = charsetEncoder.encode(CharBuffer.wrap(s));
    out.writeInt(byteBuf.remaining());
    out.write(byteBuf.array(), 0, byteBuf.remaining());
  }
}
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

  private void writeString(String s)
    throws IOException
  {
    ByteBuffer byteBuf = charsetEncoder.encode(CharBuffer.wrap(s));
    out.writeInt(byteBuf.remaining());
    out.write(byteBuf.array(), 0, byteBuf.remaining());
  }
}
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

        // Write until there's not more data ...
        while (!queue.isEmpty()) {
          ByteBuffer buf = queue.get(0);
          socketChannel.write(buf);

          if (buf.remaining() > 0) {
            // ... or the socket's buffer fills up
            break;
          }
          queue.remove(0);
        }
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

            dataBuf.flip();

            if ( log.isLoggable( Level.FINE ) )
            {
                byte[] tmp = new byte[dataBuf.remaining()];
                dataBuf.get( tmp );
                dataBuf.position( 0 );
                log.log( Level.FINE, "Client request read:\n" + new String( tmp, EJConstants.EJOE_DEFAULT_CHARSET ) );
            }
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

                    dataBuf.flip();
                }

                if ( log.isLoggable( Level.FINE ) )
                {
                    byte[] tmp = new byte[dataBuf.remaining()];
                    dataBuf.get( tmp );
                    dataBuf.position( 0 );
                    log.log( Level.FINE, "Going to send request..."
                            + new String( tmp, EJConstants.EJOE_DEFAULT_CHARSET ) );
                }
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.