Examples of slice()


Examples of java.nio.ByteBuffer.slice()

            if (encoding != DataBlockEncoding.NONE) {
              // We expect a two-byte big-endian encoding id.
              assertEquals(0, actualBuffer.get(0));
              assertEquals(encoding.getId(), actualBuffer.get(1));
              actualBuffer.position(2);
              actualBuffer = actualBuffer.slice();
            }

            ByteBuffer expectedBuffer = encodedBlocks.get(blockId);
            expectedBuffer.rewind();
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

            for (int i = 1; i < 5; i++) {
                int size = buffer.remaining() + i;
                IoBuffer extendedBuffer = IoBuffer.wrap(ByteBuffer.allocate(size));
                int start = extendedBuffer.position();
                extendedBuffer.put(buffer.slice());
                extendedBuffer.position(start);
                extendedBuffer.limit(start + size);

                try {
                    decoder.decode(extendedBuffer);
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

        byte[] dataAsBytes = new byte[bodySize];
        tupleInput.readFast(dataAsBytes);

        ByteBuffer buf = ByteBuffer.wrap(dataAsBytes);
        buf.position(1);
        buf = buf.slice();
        MessageMetaDataType type = MessageMetaDataTypeRegistry.fromOrdinal(dataAsBytes[0]);
        return type.createMetaData(buf);
    }

    @Override
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

        final int bodySize = 1 + metaData.getStorableSize();
        byte[] underlying = new byte[bodySize];
        underlying[0] = (byte) metaData.getType().ordinal();
        ByteBuffer buf = ByteBuffer.wrap(underlying);
        buf.position(1);
        buf = buf.slice();

        metaData.writeToBuffer(0, buf);
        tupleOutput.writeInt(bodySize);
        tupleOutput.writeFast(underlying);
    }
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

          throw new RuntimeException("you need to seekTo() before calling getValue()");
        }
        // TODO: Could this be done with one ByteBuffer rather than create two?
        ByteBuffer valueBuff = this.block.slice();
        valueBuff.position(this.currKeyLen);
        valueBuff = valueBuff.slice();
        valueBuff.limit(currValueLen);
        valueBuff.rewind();
        return valueBuff;
      }
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

                @Override
                public int getContent(int offsetInMessage, ByteBuffer dst)
                {
                    ByteBuffer buf = allData.duplicate();
                    buf.position(offsetInMessage);
                    buf = buf.slice();
                    int size;
                    if(dst.remaining()<buf.remaining())
                    {
                        buf.limit(dst.remaining());
                        size = dst.remaining();
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

                @Override
                public ByteBuffer getContent(int offsetInMessage, int size)
                {
                    ByteBuffer buf = allData.duplicate();
                    buf.position(offsetInMessage);
                    buf = buf.slice();
                    if(size < buf.remaining())
                    {
                        buf.limit(size);
                    }
                    return buf;
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

    public int getContent(int offset, ByteBuffer dst)
    {
        ByteBuffer src = _content.duplicate();
        src.position(offset);
        src = src.slice();
        if(dst.remaining() < src.limit())
        {
            src.limit(dst.remaining());
        }
        dst.put(src);
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

            final int bodySize = 1 + metaData.getStorableSize();
            byte[] underlying = new byte[bodySize];
            underlying[0] = (byte) metaData.getType().ordinal();
            ByteBuffer buf = ByteBuffer.wrap(underlying);
            buf.position(1);
            buf = buf.slice();

            metaData.writeToBuffer(0, buf);
            ByteArrayInputStream bis = new ByteArrayInputStream(underlying);
            try
            {
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

                        byte[] dataAsBytes = getBlobAsBytes(rs, 2);

                        ByteBuffer buf = ByteBuffer.wrap(dataAsBytes);
                        buf.position(1);
                        buf = buf.slice();
                        MessageMetaDataType type = MessageMetaDataTypeRegistry.fromOrdinal(dataAsBytes[0]);
                        StorableMessageMetaData metaData = type.createMetaData(buf);
                        StoredJDBCMessage message = new StoredJDBCMessage(messageId, metaData, true);
                        messageHandler.message(message);
                    }
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.