Class ReadBufferCoalescing

java.lang.Object
io.micronaut.http.body.stream.ReadBufferCoalescing

@Internal public final class ReadBufferCoalescing extends Object
Collects pieces of a body into a list. A body can arrive in very small pieces, e.g. one byte per HTTP chunk, and every piece has a fixed overhead far beyond its size. Small pieces are copied together, so the number of pieces kept is bounded by the number of bytes, not by the number of pieces the client chose to send.
Since:
5.2.21
  • Method Details

    • add

      public static void add(List<ReadBuffer> pieces, ReadBuffer piece, ReadBufferFactory factory)
      Add a piece to the list, taking ownership of it.
      Parameters:
      pieces - The pieces collected so far, owned by the caller
      piece - The piece to add
      factory - The factory for the copy of small pieces