Package java.nio

Examples of java.nio.ByteBuffer.duplicate()


        readTime += System.currentTimeMillis() - now;
        readOps++;

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

        return buf;
      }
    }
View Full Code Here


        ByteBuffer value = data.get(i);
        if (value == null)
            return null;

        return value.duplicate();
    }

    public ByteBuffer getBytesUnsafe(String name) {
        return getBytesUnsafe(metadata.getFirstIdx(name));
    }
View Full Code Here

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

        buf = buf.duplicate();

        buf.position(offsetInMetaData);

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

                pos += getContent(body, pos);
            }

            body.flip();

            getMetaData().setBody(body.duplicate());
        }
        return body;
    }

    public Session getSession()
View Full Code Here

            payload.flip();
        }

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

            Header oldHeader = null;
            try
            {
View Full Code Here

            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

        ByteBuffer result = ByteBuffer.allocate(dataSize() + 3 * size());
        for (int i = 0; i < size(); i++)
        {
            ByteBuffer bb = get(i);
            AbstractCompositeType.putShortLength(result, bb.remaining());
            result.put(bb.duplicate());
            result.put((byte)0);
        }
        result.flip();
        return result;
    }
View Full Code Here

        int start = b.position();
        int length = b.remaining();
        key.set(b.array(), offset + start, offset + start + length);
      } else {
        byte[] bytes = new byte[b.remaining()];
        b.duplicate().get(bytes);
        key.set(bytes);
      }
    } else {
      key.set(datum.toString());
    }
View Full Code Here

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

        buf = buf.duplicate();

        buf.position(offsetInMetaData);

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

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

        buf = buf.duplicate();

        buf.position(offsetInMetaData);

        if(dest.remaining() < buf.limit())
        {
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.