Package org.cryptacular.codec
Class Base32Encoder
java.lang.Object
org.cryptacular.codec.AbstractBaseNEncoder
org.cryptacular.codec.Base32Encoder
- All Implemented Interfaces:
Encoder
Stateful base 32 encoder with support for configurable line breaks.
- Author:
- Middleware Services
-
Field Summary
Fields inherited from class org.cryptacular.codec.AbstractBaseNEncoder
lineLength -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance that produces base 32-encoded output in the RFC 4648 alphabet,ABCDEFGHIJKLMNOPQRSTUVWXYZ234567, with no line breaks in the output.Base32Encoder(int charactersPerLine) Creates a new instance that produces base 32-encoded output in the RFC 4648 alphabet,ABCDEFGHIJKLMNOPQRSTUVWXYZ234567, with the given number of characters per line in the output.Base32Encoder(int charactersPerLine, boolean paddedOutput) Creates a new instance that produces base 32-encoded output in the RFC 4648 alphabet,ABCDEFGHIJKLMNOPQRSTUVWXYZ234567, with the given number of characters per line in the output.Base32Encoder(String alphabet) Creates a new instance that produces base 32-encoded output in the given 32-character alphabet with no line breaks in the output.Base32Encoder(String alphabet, int charactersPerLine) Creates a new instance that produces base 32-encoded output in the given 32-character alphabet with the given number of characters per line in the output.Base32Encoder(String alphabet, int charactersPerLine, boolean paddedOutput) Creates a new instance that produces base 32-encoded output in the given 32-character alphabet with the given number of characters per line in the output. -
Method Summary
Methods inherited from class org.cryptacular.codec.AbstractBaseNEncoder
encode, encodingTable, finalize, isPaddedOutput, outputSize
-
Constructor Details
-
Base32Encoder
public Base32Encoder()Creates a new instance that produces base 32-encoded output in the RFC 4648 alphabet,ABCDEFGHIJKLMNOPQRSTUVWXYZ234567, with no line breaks in the output. -
Base32Encoder
public Base32Encoder(int charactersPerLine) Creates a new instance that produces base 32-encoded output in the RFC 4648 alphabet,ABCDEFGHIJKLMNOPQRSTUVWXYZ234567, with the given number of characters per line in the output.- Parameters:
charactersPerLine- Number of characters per line. A zero or negative value disables line breaks.
-
Base32Encoder
public Base32Encoder(int charactersPerLine, boolean paddedOutput) Creates a new instance that produces base 32-encoded output in the RFC 4648 alphabet,ABCDEFGHIJKLMNOPQRSTUVWXYZ234567, with the given number of characters per line in the output.- Parameters:
charactersPerLine- Number of characters per line. A zero or negative value disables line breaks.paddedOutput- True to enable padded output, false otherwise.
-
Base32Encoder
Creates a new instance that produces base 32-encoded output in the given 32-character alphabet with no line breaks in the output.- Parameters:
alphabet- 32-character alphabet to use.
-
Base32Encoder
Creates a new instance that produces base 32-encoded output in the given 32-character alphabet with the given number of characters per line in the output.- Parameters:
alphabet- 32-character alphabet to use.charactersPerLine- Number of characters per line. A zero or negative value disables line breaks.
-
Base32Encoder
Creates a new instance that produces base 32-encoded output in the given 32-character alphabet with the given number of characters per line in the output.- Parameters:
alphabet- 32-character alphabet to use.charactersPerLine- Number of characters per line. A zero or negative value disables line breaks.paddedOutput- True to enable padded output, false otherwise.
-
-
Method Details
-
getBlockLength
protected int getBlockLength()- Specified by:
getBlockLengthin classAbstractBaseNEncoder- Returns:
- Number of bits in a block of encoded characters.
-
getBitsPerChar
protected int getBitsPerChar()- Specified by:
getBitsPerCharin classAbstractBaseNEncoder- Returns:
- Number of bits encoding a single character.
-