Interface NetworkBuffer.Builder

Enclosing interface:
NetworkBuffer

public static sealed interface NetworkBuffer.Builder
Configures and creates buffers, obtained from NetworkBuffer.builder(long). A builder can be reused, and each call to build() creates a separate buffer.
  • Method Details

    • autoResize

      Sets the resize strategy used when a write needs more room than the capacity.
      Parameters:
      autoResize - the resize strategy, or null for a buffer that does not grow
      Returns:
      this builder
    • registry

      Sets the registries for types that need them.
      Parameters:
      registries - the registries, or null for none
      Returns:
      this builder
    • build

      NetworkBuffer build()
      Creates a buffer with the configured capacity, resize strategy, and registries, with both indexes at 0. The buffer allocates native memory, which is freed once it is no longer reachable.
      Returns:
      the new buffer
      Throws:
      IllegalArgumentException - if the capacity is negative