Package java.nio

Examples of java.nio.ByteBuffer.remaining()


       
        copy.position( 0 );
       
        delayed_write = copy;
       
        return( copy.remaining());
      }
    }
   
    long  written = 0;
   
View Full Code Here


                   
                    BTBitfield bitfield = (BTBitfield)message;
           
                    ByteBuffer bb = bitfield.getBitfield().getBuffer((byte)0);
                   
                    byte[]  contents = new byte[bb.remaining()];
                   
                    bb.get( contents );
                                       
                  }else if ( message_id.equals( BTMessage.ID_BT_HAVE  )){
                   
View Full Code Here

     
      if( shrink_remaining_buffers ) {
        bb.limit( 0 )//ensure no read into this next buffer is possible
      }
      else {
        int remaining = bb.remaining();
       
        if( remaining < 1 continue//skip full buffer

        if( !marked ) {
          pre_read_start_buffer = i;
View Full Code Here

          marked = true;
        }

        if( remaining > allowed ) {  //read only part of this buffer
          bb.limit( bb.position() + allowed )//limit current buffer
          bytes_available += bb.remaining();
          shrink_remaining_buffers = true//shrink any tail buffers
        }
        else //full buffer is allowed to be read
          bytes_available += remaining;
          allowed -= remaining;  //count this buffer toward allowed and move on to the next
View Full Code Here

    try{
      for (int i=array_offset;i<array_offset+length;i++){
       
        ByteBuffer  buffer = buffers[i];
       
        int  size = buffer.remaining();
       
        if ( size > 0 ){
         
          copy_db[i= DirectByteBufferPool.getBuffer( DirectByteBuffer.AL_NET_CRYPT, size );
         
View Full Code Here

        ByteBuffer  buffer = buffers[i];
       
        int  limit = buffer.limit();
       
        try{
          if ( buffer.remaining() > rem ){
           
            buffer.limit( buffer.position() + rem );
          }
         
          rem -= buffer.remaining();
View Full Code Here

          if ( buffer.remaining() > rem ){
           
            buffer.limit( buffer.position() + rem );
          }
         
          rem -= buffer.remaining();
         
          packet_buffer.put( buffer );
         
        }finally{
         
View Full Code Here

       
        ByteBuffer  buffer = buffers[i];
       
        limits[i= buffer.limit();
       
        int  rem = buffer.remaining();
       
        if ( rem > to_write ){
         
          buffer.limit( buffer.position() + to_write );
         
View Full Code Here

     
      for (int i=array_offset;i<array_offset+length;i++){
       
        ByteBuffer  buffer = buffers[i];
       
        int  space = buffer.remaining();
       
        if ( space > 0 ){
         
          if ( space < read_insert.remaining()){
           
View Full Code Here

       
        ByteBuffer  buffer = buffers[i];
       
        limits[i= buffer.limit();
       
        int  rem = buffer.remaining();
       
        if ( rem > to_read ){
         
          buffer.limit( buffer.position() + to_read );
         
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.