Created
November 13, 2014 09:03
-
-
Save bigdragon1977/6f9909f5bbada7b79573 to your computer and use it in GitHub Desktop.
Netty java getting data from ByteBuf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ByteBuf buf = ... | |
| byte[] bytes = new byte[buf.readableBytes()]; | |
| buf.readBytes(bytes); | |
| //If you don't want the readerIndex to change: | |
| ByteBuf buf = ... | |
| byte[] bytes = new byte[buf.readableBytes()]; | |
| int readerIndex = buf.readerIndex(); | |
| buf.getBytes(readerIndex, bytes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment