Examples of asByteBuffer()


Examples of com.linkedin.data.ByteString.asByteBuffer()

      {
        nettyRequest.setHeader(e.getKey(), e.getValue());
      }

      final ByteString entity = request.getEntity();
      ChannelBuffer buf = ChannelBuffers.wrappedBuffer(entity.asByteBuffer());
      nettyRequest.setContent(buf);
      nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH, entity.length());

      return nettyRequest;
    }
View Full Code Here

Examples of com.linkedin.data.ByteString.asByteBuffer()

      for (Map.Entry<String, String> e : response.getHeaders().entrySet())
      {
        nettyResponse.setHeader(e.getKey(), e.getValue());
      }
      final ByteString entity = response.getEntity();
      ChannelBuffer buf = ChannelBuffers.wrappedBuffer(entity.asByteBuffer());
      nettyResponse.setContent(buf);
      nettyResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, entity.length());

      return nettyResponse;
    }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.StaticBuffer.asByteBuffer()

                    o.writeObject(entry.getKey(), String.class);
                    o.writeClassAndObject(entry.getValue());
                }
                final StaticBuffer buffer = o.getStaticBuffer();
                WritableUtils.writeVInt(out, buffer.length());
                out.write(ByteBufferUtil.getArray(buffer.asByteBuffer()));
            }
        }

        public static Map<String, Object> readFields(final DataInput in) throws IOException {
            final int numberOfProperties = WritableUtils.readVInt(in);
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.StaticBuffer.asByteBuffer()

                o.writeObject(key, String.class);
                o.writeClassAndObject(element.getProperty(key));
            }
            final StaticBuffer buffer = o.getStaticBuffer();
            WritableUtils.writeVInt(out, buffer.length());
            out.write(ByteBufferUtil.getArray(buffer.asByteBuffer()));
        }
    }
}
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.StaticBuffer.asByteBuffer()

                StaticBuffer key = titanMutation.getKey();
                KCVMutation mut = titanMutation.getValue();

                RowMutation rm = rowMutations.get(key);
                if (rm == null) {
                    rm = new RowMutation(keySpaceName, key.asByteBuffer());
                    rowMutations.put(key, rm);
                }

                if (mut.hasAdditions()) {
                    for (Entry e : mut.getAdditions()) {
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.StaticBuffer.asByteBuffer()

        for (Map.Entry<String, Map<StaticBuffer, KCVMutation>> keyMutation : mutations.entrySet()) {
            String columnFamily = keyMutation.getKey();
            for (Map.Entry<StaticBuffer, KCVMutation> mutEntry : keyMutation.getValue().entrySet()) {
                StaticBuffer key = mutEntry.getKey();
                ByteBuffer keyBB = key.asByteBuffer();

                // Get or create the single Cassandra Mutation object responsible for this key
                Map<String, List<org.apache.cassandra.thrift.Mutation>> cfmutation = batch.get(keyBB);
                if (cfmutation == null) {
                    cfmutation = new HashMap<String, List<org.apache.cassandra.thrift.Mutation>>(3); // TODO where did the magic number 3 come from?
View Full Code Here

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

            assertEquals(0, buffer.position());
            assertEquals(b.length, buffer.limit());
            assertEquals(b.length, buffer.capacity());
            assertEquals(b.length, buffer.remaining());
            assertTrue(buffer.hasRemaining());
            assertEquals(buffer.asByteBuffer(), ByteBuffer.wrap(b));

            random.nextBytes(b);
            buffer.put(ByteBuffer.wrap(b));
            assertEquals(b.length, buffer.position());
            assertEquals(b.length, buffer.limit());
View Full Code Here

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

            assertEquals(b.length, buffer.limit());
            assertEquals(b.length, buffer.capacity());
            assertEquals(0, buffer.remaining());
            assertFalse(buffer.hasRemaining());
            buffer.flip();
            assertEquals(buffer.asByteBuffer(), ByteBuffer.wrap(b));
            assertEquals(0, buffer.position());
            assertEquals(b.length, buffer.limit());
            assertEquals(b.length, buffer.remaining());
            assertEquals(b.length, buffer.capacity());
            assertTrue(buffer.hasRemaining());
View Full Code Here

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

        for (int i = 0; i < 256; i++) {
            buffer.put((byte) i);
        }

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

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

            assertEquals(b1.get(), buffer.get());

        buffer.clear();
        buffer.limit(random.nextInt(buffer.capacity()));
        buffer.position(random.nextInt(buffer.limit()));
        ByteBuffer b2 = buffer.asByteBuffer();
        assertEquals(buffer.position(), b2.position());
        assertEquals(buffer.limit(), b2.limit());
        assertEquals(buffer.capacity(), b2.capacity());
        while (b2.hasRemaining())
            assertEquals(b2.get(), buffer.get());
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.