Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
需要查看作为 ChannelBuffer 传入的文件的大小。
我应该使用 limit() 还是容量?它与实际尺寸准确吗?
您可以使用容量 -1(因为它是从 0 开始的)来获取 channelBuffer 中的字节数。
ChannelBuffer buffer = ...; a = buffer.capacity() - 1;