Package java.nio

Examples of java.nio.ByteBuffer.position()


    ByteBuffer md5Result  = ByteBuffer.allocate(16);
    md5Result.position(0);
    md5.finalDigest( md5Result );

    final byte[] result =new byte[16];
    md5Result.position(0);
    for (int i =0; i <result.length; i++ )
    {
      result[i] = md5Result.get();
    }  
View Full Code Here


          my_allocs[slot] = true;
         
          for (short i=0;i<slice_entry_count;i++){
           
            chunk.limit((i+1)*slice_entry_size);
            chunk.position(i*slice_entry_size);
           
            ByteBuffer  slice = chunk.slice();
           
            sliceBuffer new_buffer = new sliceBuffer( slice, slot, i );
           
View Full Code Here

            ByteBuffer  buffer = ByteBuffer.allocate(1024);
           
            try{
              long  len = filter.read( new ByteBuffer[]{ buffer }, 0, 1 );
           
              byte[]  data = new byte[buffer.position()];
             
              buffer.flip();
             
              buffer.get( data );
             
View Full Code Here

    ByteBuffer buffer = ByteBuffer.allocate(length + 12);
    buffer.putInt(length);
    buffer.put(type);
    buffer.put(contentPayload);
   
    buffer.position(4);
    buffer.limit(length + 8);
   
    long crc = crc(buffer);
    buffer.limit(length + 12);
    buffer.putInt((int)crc);
View Full Code Here

   
    long crc = crc(buffer);
    buffer.limit(length + 12);
    buffer.putInt((int)crc);
   
    buffer.position(0);
    return buffer.array();
   
  }
 
  public abstract byte[] getContentPayload();
View Full Code Here

               
        ByteBuffer  copy = ByteBuffer.allocate( buffer_rem );
       
        copy.put( buffer );
       
        copy.position( 0 );
       
        pending_partial_writes[0] = copy;
       
        return( buffer_rem );
       
View Full Code Here

         
          ByteBuffer  copy = ByteBuffer.allocate( buffer_rem );
         
          copy.put( buffer );
         
          copy.position( 0 );
         
          new_ppw[pending_partial_writes.length] = copy;
         
          pending_partial_writes = new_ppw;
         
View Full Code Here

    buffer.put(signature);
    buffer.put(ihdr);
    buffer.put(idat);
    buffer.put(iend);
   
    buffer.position(0);
    return buffer.array();
  }
 
  public static void main(String args[]) throws Exception {
    File test = new File("/Users/olivier/Desktop/test.png");
View Full Code Here

               
        int  old_limit = b.limit();
       
        if ( b.remaining() > rem ){
         
          b.limit( b.position() + rem );
        }
       
        buffer.put( b );
       
        b.limit( old_limit );
View Full Code Here

       
        if( remaining < 1 continue//skip full buffer

        if( !marked ) {
          pre_read_start_buffer = i;
          pre_read_start_position = bb.position();
          marked = true;
        }

        if( remaining > allowed ) {  //read only part of this buffer
          bb.limit( bb.position() + allowed )//limit current buffer
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.