Examples of limit()


Examples of java.nio.MappedByteBuffer.limit()

         
        size = Math.min(size, fc.size()-offset);
        MappedByteBuffer buf = fc.map(MapMode.READ_ONLY, offset, size);
        for(DirectByteBuffer b : buffers)
        {
          buf.limit(buf.position()+b.remaining(DirectByteBuffer.SS_FILE));
          b.put(DirectByteBuffer.SS_FILE, buf);
        }
         
       
      } else {
View Full Code Here

Examples of java.nio.ShortBuffer.limit()

    return direct_buffer;
  }

  private static ShortBuffer doNoCopyWrap(ShortBuffer buffer) {
    ShortBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.limit(buffer.limit());
    direct_buffer.position(buffer.position());
    return direct_buffer;
  }

  private static IntBuffer doNoCopyWrap(IntBuffer buffer) {
View Full Code Here

Examples of net.openhft.lang.io.ByteBufferBytes.limit()

                            while (bufferBytes.remaining() > 0) {

                                final long entrySize = bufferBytes.readStopBit();

                                final long position = bufferBytes.position();
                                final long limit = bufferBytes.limit();

                                bufferBytes.limit(position + entrySize);
                                externalizable.readExternalEntry(bufferBytes);

                                bufferBytes.position(position);
View Full Code Here

Examples of net.rubyeye.xmemcached.buffer.IoBuffer.limit()

    IoBuffer emptyBuffer = this.allocator.allocate(0);

    assertNotNull(emptyBuffer);
    assertEquals(0, emptyBuffer.capacity());
    assertEquals(0, emptyBuffer.position());
    assertEquals(0, emptyBuffer.limit());

    try {
      emptyBuffer.put((byte) 0);
      fail();
    } catch (BufferOverflowException e) {
View Full Code Here

Examples of net.sf.cindy.Buffer.limit()

            buffer.put((byte) i);
        }
        while (buffer.hasRemaining())
            buffer.put((byte) 0);
        buffer.position(100);
        buffer.limit(200);

        Buffer b = buffer.slice();
        b.position(40);
        b.compact();
        assertEquals(b.position(), 60);
View Full Code Here

Examples of org.activeio.Packet.limit()

        if( dup.remaining() < payloadLength+RECORD_FOOTER_SIZE ) {
            return false;
        }
       
        // Set limit to create a slice of the payload.
        dup.limit(dup.position()+payloadLength);
        this.payload = dup.slice();       
      if( isChecksumingEnabled() ) {
          checksum(new DataInputStream(new PacketInputStream(payload)));
      }
     
View Full Code Here

Examples of org.apache.activeio.packet.Packet.limit()

        if( dup.remaining() < payloadLength+RECORD_FOOTER_SIZE ) {
            return false;
        }
       
        // Set limit to create a slice of the payload.
        dup.limit(dup.position()+payloadLength);
        this.payload = dup.slice();       
      if( isChecksumingEnabled() ) {
          checksum(new DataInputStream(new PacketToInputStream(payload)));
      }
     
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.limit()

        String text = "bla bla yada yada haha haha";
        byte[] b1 = text.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        assertEquals(0, inbuffer.pos());
        assertEquals(27, inbuffer.limit());
        assertEquals(27, inbuffer.length());

        inbuffer.read();
        inbuffer.read();
View Full Code Here

Examples of org.apache.mina.codec.IoBuffer.limit()

            IoBuffer buffer = IoBuffer.wrap(encoder.encode(value));

            for (int i = 0; i < buffer.remaining(); i++) {
                IoBuffer partialBuffer = buffer.slice();
                partialBuffer.limit(partialBuffer.position() + i);
                try {
                    assertNull(decoder.decode(partialBuffer));
                } catch (ProtocolDecoderException e) {
                    fail("Should not throw exception");
                }
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.limit()

        ByteBuffer buf = ByteBuffer.allocate(objectSize + 4, false);
        buf.putInt(objectSize);
        in.readFully(buf.array(), 4, objectSize);
        buf.position(0);
        buf.limit(objectSize + 4);

        Object answer = buf.getObject(classLoader);
        buf.release();
        return answer;
    }
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.