Package java.nio

Examples of java.nio.ByteBuffer.limit()


    {
        buffer.clear();
        int size=buffer.capacity();
        ByteBuffer bbuf = ((NIOBuffer)buffer).getByteBuffer();
        bbuf.position(0);
        bbuf.limit(size);
       
        if (size==_applicationBufferSize)
            _applicationBuffers.add(buffer);
        else if (size==_packetBufferSize)
            _packetBuffers.add(buffer);
View Full Code Here


           
            ByteBuffer buff = (ByteBuffer)entry[0];
           
                buff.clear();
               
            buff.limit( length );
           
            return( new DirectByteBuffer( allocator, buff, this ));
          }
        } 
 
View Full Code Here

 
        DirectByteBuffer  buffer = new DirectByteBuffer( allocator, ByteBuffer.allocate( pool_sizes[pool_index] ), this );
       
        ByteBuffer buff = buffer.getBufferInternal();
                 
        buff.limit( length );
       
        return( buffer );
 
      }else{
     
View Full Code Here

             
            }else{
                          
              ByteBuffer  bb   = Constants.DEFAULT_CHARSET.encode( tempString );          
             
              writeInt( bb.limit() );
             
              writeChar(':');
             
              writeByteBuffer(bb );
            }
View Full Code Here

            }
           
       }else if(object instanceof ByteBuffer ){
        
           ByteBuffer  bb = (ByteBuffer)object;
           writeInt(bb.limit());
           writeChar(':');
            writeByteBuffer(bb);
           
       }else if ( object == null ){
        
View Full Code Here

          length_buffer.flip();
        }
      }else{
       
        int  rem = payload_buffer.remaining();
        int  lim  = payload_buffer.limit();
       
        if ( rem > read_lim ){
         
          payload_buffer.limit( payload_buffer.position() + read_lim );
        }
View Full Code Here

          payload_buffer.limit( payload_buffer.position() + read_lim );
        }

        bytes_read = transport.read( buffers, 1, 1 );
       
        payload_buffer.limit( lim );

        data_bytes_last_read += bytes_read;
       
        if ( payload_buffer.hasRemaining()){
         
View Full Code Here

  {
    ByteBuffer  duplicate = getBufferInternal().duplicate();
   
    duplicate.position( duplicate.position() + offset );
   
    duplicate.limitduplicate.position() + length );
   
    ReferenceCountedDirectByteBuffer res = new ReferenceCountedDirectByteBufferDuplicate( duplicate );
   
    return( res );
  }
View Full Code Here

       
    ByteBuffer buff = res.getBufferInternal();
   
        buff.clear();   //scrub the buffer
       
    buff.limit( _length );
   
        bytesOut += buff.capacity();
                               
        if ( DEBUG_PRINT_MEM || DEBUG_TRACK_HANDEDOUT ){
         
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

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.