Package java.nio

Examples of java.nio.ByteBuffer.remaining()


       
        ByteBuffer bb = buffers[ i ];
         
        int orig_limit = data_already_read.limit();
         
        if( data_already_read.remaining() > bb.remaining() ) {
         
          data_already_read.limit( data_already_read.position() + bb.remaining() );
        }
         
        inserted += data_already_read.remaining();
View Full Code Here


         
        int orig_limit = data_already_read.limit();
         
        if( data_already_read.remaining() > bb.remaining() ) {
         
          data_already_read.limit( data_already_read.position() + bb.remaining() );
        }
         
        inserted += data_already_read.remaining();
         
        bb.put( data_already_read );
View Full Code Here

           
            raw_buffers[buffer_count] = buff;
           
            orig_positions[buffer_count] = buff.position();
           
            total_sofar += buff.remaining();

            buffer_count++;
           
            if ( total_sofar >= max_bytes ){
           
View Full Code Here

          DirectByteBuffer[] payloads = msg.getRawData();

          for( int x=0; x < payloads.length; x++ ) {
            ByteBuffer bb = payloads[x].getBuffer( DirectByteBuffer.SS_NET );

            int bytes_written = (bb.limit() - bb.remaining()) - orig_positions[ pos ];
            total_size -= bytes_written;

            if ( msg.getType() == Message.TYPE_DATA_PAYLOAD ){
              total_data_size -= bytes_written;
            }
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

         
          for ( DirectByteBuffer buffer: buffers ){

            ByteBuffer bb = buffer.getBuffer( SS_FILE );
           
            int  rem = bb.remaining();
           
            bb.put( new byte[rem] );
          }
        }else{
       
View Full Code Here

                    try{
                      ByteBuffer  bb = p_buffer.toByteBuffer();
                                         
                      bb.position( 0 );
                     
                      int  read = bb.remaining();

                      bb.get( buffer, write_pos, read );
                     
                      write_pos   += read;
                      rem      -= read;
View Full Code Here

    FileChannel in = new RandomAccessFile(src, "r").getChannel();

    ByteBuffer b = ByteBuffer.allocate(128);
    b.order(ByteOrder.LITTLE_ENDIAN);

    in.read(b, in.size() - b.remaining());

    final long size = b.getInt(b.limit() - 4);

    in.close();
View Full Code Here

    FileChannel in = new RandomAccessFile(src, "r").getChannel();

    ByteBuffer b = ByteBuffer.allocate(128);
    b.order(ByteOrder.LITTLE_ENDIAN);

    in.read(b, in.size() - b.remaining());

    final long size = b.getInt(b.limit() - 8);

    in.close();
View Full Code Here

      // Read bucket count, bucket size and item count from the file
      ByteBuffer buf = ByteBuffer.allocate((int)HEADER_LENGTH);
      fileChannel.read(buf, 0L);
      buf.rewind();

      if (buf.remaining() < HEADER_LENGTH) {
        throw new IOException("File too short to be a compatible hash file");
      }

      byte[] magicNumber = new byte[MAGIC_NUMBER.length];
      buf.get(magicNumber);
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.