Package java.nio

Examples of java.nio.ByteBuffer.capacity()


    if (o instanceof DynamicByteBuffer) {
      attachment = ((DynamicByteBuffer)o).getByteBuffer();
    } else {
      attachment = (ByteBuffer) o;
    }
    if (attachment.capacity() < READ_BUFFER_SIZE) {
      attachment = ByteBuffer.allocate(READ_BUFFER_SIZE);
    }
    attachment.clear()// prepare for reuse
    return attachment;
  }
View Full Code Here


  {
    if ( USE_POOLS ){
     
      ByteBuffer  buff = buffer.getBufferInternal();
     
      int  length = buff.capacity();
     
      int  pool_index = getPoolIndex( length );
     
      if ( pool_index != -1 ){
       
View Full Code Here

   
        buff.clear();   //scrub the buffer
       
    buff.limit( _length );
   
        bytesOut += buff.capacity();
                               
        if ( DEBUG_PRINT_MEM || DEBUG_TRACK_HANDEDOUT ){
         
          synchronized( handed_out ){
                   
View Full Code Here

    if ( buff == null ){
     
      Debug.out( "Returned dbb has null delegate" );
    }
   
    int  capacity = buff.capacity();

    bytesIn += capacity;
       
      if ( DEBUG_TRACK_HANDEDOUT ){
       
View Full Code Here

     * change if r1 < position < r2 and if r1.length != r2.length, otherwise the
     * position should still end up on same record's start position
     */
    this.seek(p);

    this.autoflush.autoflushChange(b1.capacity() + b2.capacity());
  }
}
View Full Code Here

        if(filebuffer == null) {
            System.out.println("Error loading file: " + args[0]);
            System.exit(-1);
        }
       
        System.out.println("loaded " + filebuffer.capacity());
       
        //ALUTLoadWAVData file = alut.loadWAVMemory(Sys.getDirectBufferAddress(filebuffer));
        if(usingVorbis) {
          // pass directly to buffer data
          AL10.alBufferData(buffers.get(0), AL10.AL_FORMAT_VORBIS_EXT, filebuffer, -1);
View Full Code Here

        final MapMode mapMode = ((readwrite) ? MapMode.READ_WRITE
            : MapMode.READ_ONLY);
        buf = this.channel.map(mapMode, regional, minimum);
        buf.clear();

        block = new BufferBlock(buf, BitBuffer.wrap(buf), regional, buf.capacity());
        block.getByteBuffer().order(this.byteOrder);

        System.gc();

        break;
View Full Code Here

    buffer.reset();

    final int MAX_HEADER_LENGTH = 24;
    final ByteBuffer view = BufferUtils.duplicate(buffer);
    final int capacity = view.capacity();
    boolean status = true;

    for (int i = 0; i < count && view.position() + MAX_HEADER_LENGTH < capacity; i++) {
      view.mark();
      long length = headerReader.readLength(view);
View Full Code Here

        status = false;
        break;
      }
      view.reset();

      if (p + MAX_HEADER_LENGTH > view.capacity()) {
        break;
      }

      view.limit(p + MAX_HEADER_LENGTH);
      view.position(p);
View Full Code Here

          int size = icon.limit() / 4;
          int dimension = (int)Math.sqrt(size);
          if ( dimension > 0 ) {
            ByteBuffer icon_rgb = convertIcon(icon, dimension, dimension);
            ByteBuffer icon_mask = convertIconMask(icon, dimension, dimension);
            nSetWindowIcon(getDisplay(), getWindow(), icon_rgb, icon_rgb.capacity(), icon_mask, icon_mask.capacity(), dimension, dimension);
            return 1;
          }
        }
        return 0;
      } finally {
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.