Class BufferConfiguration.Builder<Configuration extends BufferConfiguration<Configuration>,​BuilderType extends BufferConfiguration.Builder<Configuration,​BuilderType>>

  • Type Parameters:
    Configuration - the type of BufferConfiguration.
    BuilderType - the type of Builder that builds BufferConfiguration subclasses of type `Configuration`.
    Direct Known Subclasses:
    IonBufferConfiguration.Builder
    Enclosing class:
    BufferConfiguration<Configuration extends BufferConfiguration<Configuration>>

    public abstract static class BufferConfiguration.Builder<Configuration extends BufferConfiguration<Configuration>,​BuilderType extends BufferConfiguration.Builder<Configuration,​BuilderType>>
    extends java.lang.Object
    Provides logic common to all BufferConfiguration Builder implementations.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • withInitialBufferSize

        public final BuilderType withInitialBufferSize​(int initialBufferSizeInBytes)
        Sets the initial size of the buffer that will be used to hold the data between top-level values. Default: 32KB.
        Parameters:
        initialBufferSizeInBytes - the value.
        Returns:
        this Builder.
      • getInitialBufferSize

        public final int getInitialBufferSize()
        Returns:
        the initial size of the lookahead buffer, in bytes.
      • onData

        public final BuilderType onData​(BufferConfiguration.DataHandler handler)
        Sets the handler that will be notified when data is processed. The handler may be null, in which case the number of bytes processed will not be reported.
        Parameters:
        handler - the handler.
        Returns:
        this builder.
      • withMaximumBufferSize

        public final BuilderType withMaximumBufferSize​(int maximumBufferSizeInBytes)
        Set the maximum number of bytes between top-level values. This can be used to limit growth of the internal buffer. For binary Ion, the minimum value is 5 because all valid binary Ion data begins with a 4-byte Ion version marker and the smallest value is 1 byte. For delimited text Ion, the minimum value is 2 because the smallest text Ion value is 1 byte and the smallest delimiter is 1 byte. Default: Integer.MAX_VALUE.
        Parameters:
        maximumBufferSizeInBytes - the value.
        Returns:
        this builder.
      • getMaximumBufferSize

        public int getMaximumBufferSize()
        Returns:
        the maximum number of bytes that will be buffered.
      • getMinimumMaximumBufferSize

        public abstract int getMinimumMaximumBufferSize()
        Gets the minimum allowed maximum buffer size.
        Returns:
        the value.
      • build

        public abstract Configuration build()
        Creates a new BufferConfiguration from the Builder's current settings.
        Returns:
        a new instance.