Examples of duplicate()


Examples of java.nio.ByteBuffer.duplicate()

        {
            buf = encodeAsBuffer();
            _encoded = buf;
        }

        buf = buf.duplicate();

        buf.position(offsetInMetaData);

        if(dest.remaining() < buf.limit())
        {
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

    public ByteBuffer getBytesUnsafe(int i) {
        ByteBuffer value = getValue(i);
        if (value == null)
            return null;

        return value.duplicate();
    }

    /**
     * {@inheritDoc}
     */
 
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

            ByteBuffer payload = xfr.getPayload();
            int payloadSent = send(xfr, payload);

            if(payload != null && payloadSent < payload.remaining())
            {
                payload = payload.duplicate();
try
{
                payload.position(payload.position()+payloadSent);
}
catch(IllegalArgumentException e)
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

                payload.flip();
            }

            if(queueEntry.getDeliveryCount() != 0)
            {
                payload = payload.duplicate();
                ValueHandler valueHandler = new ValueHandler(_typeRegistry);

                Header oldHeader = null;
                try
                {
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

                            numbytes += channel.read(message);
                        }
                        message.position(0);
                        synchronized (recvQueue) {
                            recvQueue
                                    .put(new Message(message.duplicate(), sid));
                        }
                        msgLength.position(0);
                    }
                }
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

        {
            buf = encodeAsBuffer();
            _encoded = buf;
        }

        buf = buf.duplicate();

        buf.position(offsetInMetaData);

        if(dest.remaining() < buf.limit())
        {
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

                ch.size());
        ByteBuffer bb = ch.map(MapMode.READ_ONLY, ch.position(), size);
        bb.order(BYTE_ORDER);

        if (LOG.isDebugEnabled()) {
            LOG.debug("bb=" + bb.toString() + " content=" + bb.duplicate().asCharBuffer());
        }

        return bb;
    }
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

     * JNI operations fail on non-byte views of a direct buffer.
     */
    public void testBufferView() {
        ByteBuffer b = ByteBuffer.allocateDirect(100);
        assertTrue(b.isDirect());
        assertView("duplicate", b, b.duplicate(), 1);
        assertView("char view", b, b.asCharBuffer(), 2);
        assertView("short view", b, b.asShortBuffer(), 2);
        assertView("int view", b, b.asIntBuffer(), 4);
        assertView("float view", b, b.asFloatBuffer(), 4);
        assertView("double view", b, b.asDoubleBuffer(), 8);
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

          ByteBuffer cachedBuf = cache.getBlock(name + block);
          if (cachedBuf != null) {
            // Return a distinct 'copy' of the block, so pos doesnt get messed by
            // the scanner
            cacheHits++;
            return cachedBuf.duplicate();
          }
          // Carry on, please load.
        }

        // Load block from filesystem.
View Full Code Here

Examples of java.nio.ByteBuffer.duplicate()

        buf.limit(buf.limit() - DATABLOCKMAGIC.length);
        buf.rewind();

        // Cache the block
        if(cacheBlock && cache != null) {
          cache.cacheBlock(name + block, buf.duplicate(), inMemory);
        }

        return buf;
      }
    }
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.