Package org.apache.commons.codec.binary
Class Base58.Builder
- java.lang.Object
-
- org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder<Base58,Base58.Builder>
-
- org.apache.commons.codec.binary.Base58.Builder
-
- All Implemented Interfaces:
java.util.function.Supplier<Base58>
- Enclosing class:
- Base58
public static class Base58.Builder extends BaseNCodec.AbstractBuilder<Base58,Base58.Builder>
BuildsBase58instances with custom configuration.
-
-
Constructor Summary
Constructors Constructor Description Builder()Constructs a new Base58 builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Base58get()Gets a new Base58 instance with the configured settings.Base58.BuildersetEncodeTable(byte... encodeTable)Sets the encode table and derives the matching decode table.Base58.BuildersetLineLength(int lineLength)Sets the line length to zero.Base58.BuildersetMaxDecodeLength(int maxDecodeLength)Sets the maximum number of encoded bytes accepted by a single decode operation.Base58.BuildersetMaxEncodeLength(int maxEncodeLength)Sets the maximum number of binary bytes accepted by a single encode operation.-
Methods inherited from class org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder
setDecodeTable, setDecodingPolicy, setLineSeparator, setPadding
-
-
-
-
Constructor Detail
-
Builder
public Builder()
Constructs a new Base58 builder.
-
-
Method Detail
-
get
public Base58 get()
Gets a new Base58 instance with the configured settings.- Returns:
- A new Base58 codec.
-
setEncodeTable
public Base58.Builder setEncodeTable(byte... encodeTable)
Sets the encode table and derives the matching decode table.- Overrides:
setEncodeTablein classBaseNCodec.AbstractBuilder<Base58,Base58.Builder>- Parameters:
encodeTable- The encode table with exactly 58 unique entries, null resets to the default.- Returns:
thisinstance.- Throws:
java.lang.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:
setLineLengthin classBaseNCodec.AbstractBuilder<Base58,Base58.Builder>- Parameters:
lineLength- The line length; must not be positive.- Returns:
thisinstance.- Throws:
java.lang.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. PassInteger.MAX_VALUEto effectively disable the limit for trusted input.- Parameters:
maxDecodeLength- The maximum accepted encoded input length; must be positive.- Returns:
thisinstance.- Throws:
java.lang.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. PassInteger.MAX_VALUEto effectively disable the limit for trusted input.- Parameters:
maxEncodeLength- The maximum accepted binary input length; must be positive.- Returns:
thisinstance.- Throws:
java.lang.IllegalArgumentException- Thrown if maxEncodeLength is not positive.- Since:
- 1.23.0
-
-