Created
December 9, 2013 12:20
-
-
Save thomaslee/7871444 to your computer and use it in GitHub Desktop.
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
public final class LittleEndianLengthEncoder extends MessageToByteEncoder<ByteBuf> { | |
@Override | |
protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf in, ByteBuf out) throws Exception { | |
final ByteOrder order = out.order(); | |
out.order(ByteOrder.LITTLE_ENDIAN) | |
.writeInt(in.readInt()) | |
.order(order) | |
.writeBytes(in); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment