Skip to content

Best effort zerocopy from Protobuf's ByteString to Netty's ByteBuf #13605

Answered by normanmaurer
tisonkun asked this question in Q&A
Discussion options

You must be logged in to vote
public static ByteBuf byteStringToByteBuf(ByteString bytes) {
    final ByteBuffer byteBuffer = bytes.asReadOnlyByteBuffer();
    return Unpooled.wrappedBuffer(byteBuffer);
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tisonkun
Comment options

@He-Pin
Comment options

Answer selected by tisonkun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants