Package org.apache.commons.codec.binary
Class Base32.Builder
java.lang.Object
org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder<Base32,Base32.Builder>
org.apache.commons.codec.binary.Base32.Builder
- Enclosing class:
Base32
Builds
Base32 instances.
To configure a new instance, use a Base32.Builder. For example:
Base32 base32 = Base32.builder()
.setDecodingPolicy(DecodingPolicy.LENIENT) // default is lenient
.setLineLength(0) // default is none
.setLineSeparator('\r', '\n') // default is CR LF
.setPadding('=') // default is '='
.setEncodeTable(customEncodeTable) // default is RFC 4648 Section 6, Table 3: The Base 32 Alphabet
.get()
- Since:
- 1.17.0
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Constructs a new instance using RFC 4648 Section 6, Table 3: The Base 32 Alphabet. -
Method Summary
Modifier and TypeMethodDescriptionget()setEncodeTable(byte... encodeTable) Sets the encode table and derives the matching decode table.setHexDecodeTable(boolean useHex) Sets the encode and decode tables to use Base32 hexadecimal iftrue, otherwise use the Base32 alphabet.setHexEncodeTable(boolean useHex) Sets the encode table to use Base32 hexadecimal iftrue, otherwise use the Base32 alphabet.Methods inherited from class org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder
setDecodeTable, setDecodingPolicy, setLineLength, setLineSeparator, setPadding
-
Constructor Details
-
Builder
public Builder()Constructs a new instance using RFC 4648 Section 6, Table 3: The Base 32 Alphabet.
-
-
Method Details
-
get
-
setEncodeTable
Sets the encode table and derives the matching decode table.The RFC 4648 Base32 and Base32 Hex tables keep their case-insensitive decoders.
- Overrides:
setEncodeTablein classBaseNCodec.AbstractBuilder<Base32,Base32.Builder> - Parameters:
encodeTable- The encode table with exactly 32 unique entries, null resets to the default.- Returns:
thisinstance.- Throws:
IllegalArgumentException- if the encode table does not contain exactly 32 unique entries.
-
setHexDecodeTable
Sets the encode and decode tables to use Base32 hexadecimal iftrue, otherwise use the Base32 alphabet.This overrides a value previously set with
setEncodeTable(byte...).- Parameters:
useHex- use Base32 hexadecimal iftrue, otherwise use the Base32 alphabet.- Returns:
thisinstance.- Since:
- 1.18.0
-
setHexEncodeTable
Sets the encode table to use Base32 hexadecimal iftrue, otherwise use the Base32 alphabet.This overrides a value previously set with
setEncodeTable(byte...).- Parameters:
useHex-- If true, then use RFC 4648 Section 7, Table 4: Base 32 Encoding with Extended Hex Alphabet
- If false, then use RFC 4648 Section 6, Table 3: The Base 32 Alphabet
- Returns:
thisinstance.- Since:
- 1.18.0
-