Jack
Jack

Reputation: 16718

Constructing a Netty ChannelBuffer from a string

To convert a Netty ChannelBuffer to a String is as simple as calling .toString(UTF_8) on the ChannelBuffer. How do I create a ChannelBuffer from a String?

Upvotes: 3

Views: 4063

Answers (2)

Heiko Rupp
Heiko Rupp

Reputation: 30954

In netty 4 you can use Unpooled.copiedBuffer(String, Charset)

Upvotes: 1

Norman Maurer
Norman Maurer

Reputation: 23567

Use ChannelBuffers.copiedBuffer(String, Charset)

Upvotes: 9

Related Questions