Chapter 5. ByteBuf
This chapter covers
- ByteBuf —Netty’s data container
- API details
- Use cases
- Memory allocation
As we noted earlier, the fundamental unit of network data is always the byte. Java NIO provides ByteBuffer as its byte container, but this class makes usage overly complex and somewhat cumbersome to use.
Netty’s alternative to ByteBuffer is ByteBuf, a powerful implementation that addresses the limitations of the JDK API and provides a better API for network application developers.
In this chapter we’ll illustrate the superior functionality and flexibility of ByteBuf as compared to the JDK’s ByteBuffer. This will also give you a better understanding of Netty’s approach to data handling in general and prepare you for our discussion ...
Get Netty in Action now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.