Examples of toByteBuffer()


Examples of com.alibaba.dubbo.common.io.UnsafeByteArrayOutputStream.toByteBuffer()

                }
               
            } finally {
                NettyChannel.removeChannelIfDisconnected(ch);
            }
            return ChannelBuffers.wrappedBuffer(os.toByteBuffer());
        }
    }

    private class InternalDecoder extends SimpleChannelUpstreamHandler {
View Full Code Here

Examples of com.alibaba.dubbo.remoting.buffer.ChannelBuffer.toByteBuffer()

            Object msg = context.getMessage();
            codec.encode(channel, channelBuffer, msg);
           
            GrizzlyChannel.removeChannelIfDisconnectd(connection);
            Buffer buffer = connection.getTransport().getMemoryManager().allocate(channelBuffer.readableBytes());
            buffer.put(channelBuffer.toByteBuffer());
            buffer.flip();
            buffer.allowBufferDispose(true);
            context.setMessage(buffer);
        } finally {
            GrizzlyChannel.removeChannelIfDisconnectd(connection);
View Full Code Here

Examples of com.codecademy.eventhub.model.User.toByteBuffer()

      return id;
    }
    User user = new User.Builder(externalUserId, Maps.<String, String>newHashMap()).build();
    try {
      id = idMap.incrementNextAvailableId();
      byte[] location = JournalUtil.locationToBytes(userJournal.write(user.toByteBuffer(), true));
      MetaData metaData = new MetaData(location);
      metaDataList.add(metaData);
      idMap.put(externalUserId, id);
      return id;
    } catch (IOException e) {
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.buffer.ChannelBuffer.toByteBuffer()

        // Otherwise, all messages are encrypted.
        ChannelBuffer msg = (ChannelBuffer) e.getMessage();
        PendingWrite pendingWrite;

        if (msg.readable()) {
            pendingWrite = new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes()));
        } else {
            pendingWrite = new PendingWrite(evt.getFuture(), null);
        }

        pendingUnencryptedWritesLock.lock();
View Full Code Here

Examples of com.netflix.astyanax.serializers.AbstractSerializer.toByteBuffer()

    @Test(expected = SerializationException.class)
    public void testCannotRoundtripBytes() throws Throwable {
        try {
            byte[] expected = new byte[] {1,2,3,4,5};
            AbstractSerializer ser = NumericSerializer.serializerFor(SimpleNumber.class);
            byte[] actual = (byte[])ser.fromByteBuffer(ser.toByteBuffer(expected));
            Assert.assertArrayEquals(expected, actual);
        } catch (RuntimeException ex) {
            throw ex.getCause();
        }
    }
View Full Code Here

Examples of com.netflix.astyanax.serializers.SpecificCompositeSerializer.toByteBuffer()

    types.add(UTF8Type.instance);

    CompositeType c1 = CompositeType.getInstance(types);

    SpecificCompositeSerializer ccSerializer = new SpecificCompositeSerializer(c1);
    ByteBuffer bb2 = ccSerializer.toByteBuffer(dc);

    Composite c2 = (Composite) serializer.getColumnNameSerializer().fromByteBuffer(bb2);
    ss1Result =  (String) c2.get(0);

    Assert.assertEquals(ss1, ss1Result);
View Full Code Here

Examples of com.netflix.astyanax.serializers.StringSerializer.toByteBuffer()

    }

    private SlotState fromString(String string) {
        SlotStateSerializer slotSer = SlotStateSerializer.get();
        StringSerializer stringSer = StringSerializer.get();
        return slotSer.fromByteBuffer(stringSer.toByteBuffer(string));
    }
}
View Full Code Here

Examples of com.slytechs.utils.memory.BitBuffer.toByteBuffer()

  public BitBuffer getBuffer() throws IOException {
    final BitBuffer b = handle.getBitBuffer();

    if (bits != b) {
      b.position(b.position() + getRecordHeaderLength());
      bits = BitBuffer.wrap(b.toByteBuffer());
    }

    return bits;
  }
View Full Code Here

Examples of de.netseeker.ejoe.http.HttpRequest.toByteBuffer()

        if ( header.isClient() )
        {
            HttpRequest request = new HttpRequest( header, (header.getAttachementInfo() != null) ? header
                    .getAttachementInfo().toString() : HttpRequest.HTTP_POST );
            if ( !noBuffer ) request.addData( buffer );
            headerBuf = request.toByteBuffer();
            if ( logger.isLoggable( Level.FINEST ) )
            {
                logger.log( Level.FINEST, "Preparing to write client request with " + headerBuf.limit() + " bytes:\n"
                        + IOUtil.decodeToString( headerBuf ) );
            }
View Full Code Here

Examples of de.netseeker.ejoe.http.HttpResponse.toByteBuffer()

            {
                // create a HTTP response with just our server header byte as content
                HttpResponse response = new HttpResponse( header, HttpResponse.HTTP_OK );
                response.addData( header.toByte() );
                logger.log( Level.FINEST, "Sending server headerbyte: " + header );
                hBuffer = response.toByteBuffer();
                semiBlockingWrite( channel, hBuffer, timeout );
                if ( hBuffer.hasRemaining() ) return null;
            }
            // ok, a unknown client which might have already send some content with it's first request
            else if ( parser.hasPrereadContent() )
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.