Examples of asByteBuffer()


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

        buffer.clear();
        buffer.limit(random.nextInt(buffer.capacity()));
        buffer.position(random.nextInt(buffer.limit()));
        buffer = buffer.slice();
        ByteBuffer b3 = buffer.asByteBuffer();
        assertEquals(buffer.position(), b3.position());
        assertEquals(buffer.limit(), b3.limit());
        assertEquals(buffer.capacity(), b3.capacity());
        while (b3.hasRemaining())
            assertEquals(b3.get(), buffer.get());
View Full Code Here

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

    private String _getString(int i, Charset charset, int bufferLen) {
        Buffer buffer = BufferFactory.allocate(bufferLen);
        batch(true, i, buffer, bufferLen);
        buffer.position(0);
        try {
            return charset.decode(buffer.asByteBuffer());
        } finally {
            buffer.release();
        }
    }
View Full Code Here

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

            runnable.run();
    }

    private Packet decode(Session session, Packet packet) throws Exception {
        Buffer src = packet.getContent();
        ByteBuffer srcBuffer = src.asByteBuffer();

        int size = appBufferSize
                * (int) Math.ceil((double) (src.remaining() + 1)
                        / netBufferSize);
        Buffer dest = BufferFactory.allocate(size);
View Full Code Here

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

        int size = appBufferSize
                * (int) Math.ceil((double) (src.remaining() + 1)
                        / netBufferSize);
        Buffer dest = BufferFactory.allocate(size);
        ByteBuffer destBuffer = dest.asByteBuffer();

        boolean hasAppData = false;

        // decode
        while (true) {
View Full Code Here

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

            super.packetReceived(filterChain, decodedPacket);
    }

    private Packet encode(Session session, Packet packet) throws Exception {
        Buffer src = packet.getContent();
        ByteBuffer srcBuffer = src.asByteBuffer();

        int size = netBufferSize
                * (int) Math.ceil((double) (src.remaining() + 1)
                        / appBufferSize);
        Buffer dest = BufferFactory.allocate(size);
View Full Code Here

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

        int size = netBufferSize
                * (int) Math.ceil((double) (src.remaining() + 1)
                        / appBufferSize);
        Buffer dest = BufferFactory.allocate(size);
        ByteBuffer destBuffer = dest.asByteBuffer();

        // encode
        while (true) {
            SSLEngineResult result = engine.wrap(srcBuffer, destBuffer);
            Status status = result.getStatus();
View Full Code Here

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

            }

            protected void read() throws IOException {
                while (true) {
                    Buffer buffer = BufferFactory.allocate(getReadPacketSize());
                    ByteBuffer byteBuffer = buffer.asByteBuffer();

                    try {
                        SocketAddress address = channel.receive(byteBuffer);
                        if (address == null) {
                            buffer.release();
View Full Code Here

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

                Buffer buffer = packet.getContent();
                int writeCount = 0;
                if (packet.getAddress() == null) // connected
                    writeCount = buffer.write(channel);
                else {
                    writeCount = channel.send(buffer.asByteBuffer(), packet
                            .getAddress());
                    buffer.skip(writeCount);
                }
                return writeCount != 0;
            }
View Full Code Here

Examples of org.apache.cassandra.io.util.DataOutputBuffer.asByteBuffer()

        {
            DataOutputBuffer out = new DataOutputBuffer(serializedSize());
            ByteBufferUtil.writeWithShortLength(partitionKey, out);
            ByteBufferUtil.writeWithShortLength(cellName, out);
            out.writeInt(remaining);
            return out.asByteBuffer();
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of org.apache.cassandra.io.util.DataOutputBuffer.asByteBuffer()

        catch (IOException e)
        {
            throw new AssertionError(); // cannot happen.
        }

        return buf.asByteBuffer();
    }

    @VisibleForTesting
    void replayAllFailedBatches() throws ExecutionException, InterruptedException
    {
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.