Class BufferSizeOption

java.lang.Object
io.smallrye.common.io.BufferSizeOption
All Implemented Interfaces:
OpenOption

public final class BufferSizeOption extends Object implements OpenOption
An OpenOption that specifies the buffer size to use when opening something which supports buffering.

Instances are obtained via the of(int) or ofDefault() factory methods. The default buffer size is DEFAULT_BUFFER_SIZE bytes.

  • Field Details

    • MIN_BUFFER_SIZE

      public static final int MIN_BUFFER_SIZE
      The smallest allowed buffer size.
    • DEFAULT_BUFFER_SIZE

      public static final int DEFAULT_BUFFER_SIZE
      The default buffer size.
  • Method Details

    • of

      public static BufferSizeOption of(int bufferSize)
      Returns an option specifying the given buffer size. If the given buffer size is less than the minimum size, it will be rounded up to that size.
      Parameters:
      bufferSize - the buffer size in bytes (must be at least 1)
      Returns:
      an option specifying the given buffer size
    • ofDefault

      public static BufferSizeOption ofDefault()
      Returns an option specifying the default buffer size.
      Returns:
      an option specifying the default buffer size
    • bufferSize

      public int bufferSize()
      Returns the buffer size in bytes.
      Returns:
      the buffer size in bytes
    • equals

      public boolean equals(Object obj)
      Returns true if the given object is a BufferSizeOption with the same buffer size.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare
      Returns:
      true if the given object is a BufferSizeOption with the same buffer size
    • equals

      public boolean equals(BufferSizeOption obj)
      Returns true if the given option has the same buffer size as this one.
      Parameters:
      obj - the option to compare
      Returns:
      true if the given option has the same buffer size as this one
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object