Class MemoryOutputStream.Builder<B extends MemoryOutputStream.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
MemoryOutputStream

public static class MemoryOutputStream.Builder<B extends MemoryOutputStream.Builder<B>> extends OutputStream.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public MemoryOutputStream build()
      Finish building the MemoryOutputStream object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to MemoryOutputStream.
      Overrides:
      build in class OutputStream.Builder<B extends MemoryOutputStream.Builder<B>>
      Returns:
      a new instance of MemoryOutputStream with the properties that were set in the Builder object.
    • setData

      public B setData(MemorySegment data)
      Pointer to buffer where data will be written.
      Parameters:
      data - the value for the data property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.24
    • setDestroyFunction

      public B setDestroyFunction(MemorySegment destroyFunction)
      Function called with the buffer as argument when the stream is destroyed.
      Parameters:
      destroyFunction - the value for the destroy-function property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.24
    • setReallocFunction

      public B setReallocFunction(MemorySegment reallocFunction)
      Function with realloc semantics called to enlarge the buffer.
      Parameters:
      reallocFunction - the value for the realloc-function property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.24
    • setSize

      public B setSize(int size)
      Current size of the data buffer.
      Parameters:
      size - the value for the size property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.24