Package org.cryptacular.codec
Class Base64Encoder.Builder
java.lang.Object
org.cryptacular.codec.Base64Encoder.Builder
- Enclosing class:
Base64Encoder
Builder for base-64 encoders.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringArbitrary alphbet.private intNumber of base-64 characters per line in output.private booleanPadding flag.private booleanURL-safe alphabet flag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a base-64 encoder with the given options.setAlphabet(String alpha) Sets an arbitrary 64-character alphabet for encoding.setCharactersPerLine(int lineLength) Sets the number of characters per line in output produced by the encoder.setPadding(boolean pad) Sets padding flag on the encoder.setUrlSafe(boolean safe) Sets the URL-safe alphabet flag.
-
Field Details
-
urlSafe
private boolean urlSafeURL-safe alphabet flag. -
alphabet
Arbitrary alphbet. -
padding
private boolean paddingPadding flag. -
charactersPerLine
private int charactersPerLineNumber of base-64 characters per line in output.
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setUrlSafe
Sets the URL-safe alphabet flag.- Parameters:
safe- True for URL-safe alphabet, false otherwise.- Returns:
- This instance.
-
setAlphabet
Sets an arbitrary 64-character alphabet for encoding.- Parameters:
alpha- Alternative alphabet.- Returns:
- This instance.
-
setPadding
Sets padding flag on the encoder.- Parameters:
pad- True for base-64 padding, false otherwise.- Returns:
- This instance.
-
setCharactersPerLine
Sets the number of characters per line in output produced by the encoder.- Parameters:
lineLength- Number of characters per line. Set to-1to suppress line breaks.- Returns:
- This instance.
-
build
Builds a base-64 encoder with the given options.- Returns:
- New base-64 encoder instance.
-