Class Base58.Builder

All Implemented Interfaces:
Supplier<Base58>
Enclosing class:
Base58

public static class Base58.Builder extends BaseNCodec.AbstractBuilder<Base58,Base58.Builder>
Builds Base58 instances with custom configuration.
  • Field Details

    • maxDecodeLength

      private int maxDecodeLength
    • maxEncodeLength

      private int maxEncodeLength
  • Constructor Details

    • Builder

      public Builder()
      Constructs a new Base58 builder.
  • Method Details

    • get

      public Base58 get()
      Gets a new Base58 instance with the configured settings.
      Returns:
      A new Base58 codec.
    • getMaxDecodeLength

      int getMaxDecodeLength()
    • getMaxEncodeLength

      int getMaxEncodeLength()
    • setEncodeTable

      public Base58.Builder setEncodeTable(byte... encodeTable)
      Sets the encode table and derives the matching decode table.
      Overrides:
      setEncodeTable in class BaseNCodec.AbstractBuilder<Base58,Base58.Builder>
      Parameters:
      encodeTable - The encode table with exactly 58 unique entries, null resets to the default.
      Returns:
      this instance.
      Throws:
      IllegalArgumentException - Thrown if the encode table does not contain exactly 58 unique entries.
    • setLineLength

      public Base58.Builder setLineLength(int lineLength)
      Sets the line length to zero.

      Base58 does not support line chunking. Zero or a negative value selects unchunked output.

      Overrides:
      setLineLength in class BaseNCodec.AbstractBuilder<Base58,Base58.Builder>
      Parameters:
      lineLength - The line length; must not be positive.
      Returns:
      this instance.
      Throws:
      IllegalArgumentException - Thrown if lineLength is positive.
      Since:
      1.23.0
    • setMaxDecodeLength

      public Base58.Builder setMaxDecodeLength(int maxDecodeLength)
      Sets the maximum number of encoded bytes accepted by a single decode operation.

      Defaults to Base58.DEFAULT_MAX_DECODE_LENGTH. Pass Integer.MAX_VALUE to effectively disable the limit for trusted input.

      Parameters:
      maxDecodeLength - The maximum accepted encoded input length; must be positive.
      Returns:
      this instance.
      Throws:
      IllegalArgumentException - Thrown if maxDecodeLength is not positive.
      Since:
      1.23.0
    • setMaxEncodeLength

      public Base58.Builder setMaxEncodeLength(int maxEncodeLength)
      Sets the maximum number of binary bytes accepted by a single encode operation.

      Defaults to Base58.DEFAULT_MAX_ENCODE_LENGTH. Pass Integer.MAX_VALUE to effectively disable the limit for trusted input.

      Parameters:
      maxEncodeLength - The maximum accepted binary input length; must be positive.
      Returns:
      this instance.
      Throws:
      IllegalArgumentException - Thrown if maxEncodeLength is not positive.
      Since:
      1.23.0