ByteBufferUtils (Apache Tomcat 10.1.16 API Documentation)
Description: declaration: package: org.apache.tomcat.util.buf, class: ByteBufferUtils

Package org.apache.tomcat.util.buf

# Class ByteBufferUtils

java.lang.Object
org.apache.tomcat.util.buf.ByteBufferUtils

public class ByteBufferUtils extends Object

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `cleanDirectBuffer(ByteBuffer buf)`
  `static ByteBuffer`
  `expand(ByteBuffer in, int newSize)`
  Expands buffer to the given size unless it is already as big or bigger.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### expand

    public static ByteBuffer expand(ByteBuffer in, int newSize)
    Expands buffer to the given size unless it is already as big or bigger. Buffers are assumed to be in 'write to' mode since there would be no need to expand a buffer while it was in 'read from' mode.
    Parameters:
      `in` - Buffer to expand
      `newSize` - The size t which the buffer should be expanded
    Returns:
      The expanded buffer with any data from the input buffer copied in to it or the original buffer if there was no need for expansion

  - ### cleanDirectBuffer

    public static void cleanDirectBuffer(ByteBuffer buf)