Examples of remaining()


Examples of java.nio.ByteBuffer.remaining()

          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

Examples of java.nio.ByteBuffer.remaining()

     
      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

Examples of java.nio.ByteBuffer.remaining()

         
          for ( DirectByteBuffer buffer: buffers ){

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

Examples of java.nio.ByteBuffer.remaining()

                    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

Examples of java.nio.ByteBuffer.remaining()

    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

Examples of java.nio.ByteBuffer.remaining()

    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

Examples of java.nio.ByteBuffer.remaining()

      // 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

Examples of java.nio.ByteBuffer.remaining()

      // Verify file header
      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 ID file");
      }

      byte[] magicNumber = new byte[MAGIC_NUMBER.length];
      buf.get(magicNumber);
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

      // Verify file header
      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 data file");
      }

      byte[] magicNumber = new byte[MAGIC_NUMBER.length];
      buf.get(magicNumber);
View Full Code Here

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
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.