What is the best resizable circular byte buffer available in Java?

后端 未结 5 2133
一向
一向 2021-02-01 19:42

I need a byte buffer class in Java for single-threaded use. I should be able to insert data at the back of the buffer and read data at the front, with an amortized cost of O(1).

5条回答
  •  我在风中等你
    2021-02-01 20:09

    I'm using a java.util.ArrayDeque in a project with similar requirements. Note that you can easily change implementation using a java.util.concurrent Queue implementation.

提交回复
热议问题