Growing ByteBuffer

前端 未结 11 1145
温柔的废话
温柔的废话 2021-01-31 14:21

Has anyone has ever seen an implementation of java.nio.ByteBuffer that will grow dynamically if a putX() call overruns the capacity?

The reason I want to do it this way

11条回答
  •  故里飘歌
    2021-01-31 14:58

    It may be also worth to have a look at Netty's DynamicChannelBuffer. Things that I find handy are:

    • slice(int index, int length)
    • unsigned operations
    • separated writer and reader indexes

提交回复
热议问题