Class Base64.Builder
java.lang.Object
org.apache.commons.codec.binary.BaseNCodec.AbstractBuilder<Base64, Base64.Builder>
org.apache.commons.codec.binary.Base64.Builder
- Enclosing class:
Base64
Builds
Base64 instances.
To configure a new instance, use a Base64.Builder. For example:
Base64 base64 = Base64.builder()
.setCodecPolicy(CodecPolicy.LENIENT) // default is lenient, null resets to default
.setEncodeTable(customEncodeTable) // default is built in, null resets to default
.setLineLength(0) // default is none
.setLineSeparator('\r', '\n') // default is CR LF, null resets to default
.setPadding('=') // default is '='
.setUrlSafe(false) // default is false
.get()
- Since:
- 1.17.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()Sets the format of the decoding table.setEncodeTable(byte... encodeTable) Sets the encode table.setUrlSafe(boolean urlSafe) Sets the URL-safe encoding policy.Methods inherited from class BaseNCodec.AbstractBuilder
setDecodeTable, setDecodingPolicy, setLineLength, setLineSeparator, setPadding
-
Constructor Details
-
Builder
public Builder()Constructs a new instance.
-
-
Method Details
-
get
-
setDecodeTableFormat
Sets the format of the decoding table. This method allows to explicitly state whether a standard or URL-safe Base64 decoding is expected. This method does not modify behavior on encoding operations. For configuration of the encoding behavior, please usesetUrlSafe(boolean)method.By default, the implementation uses the
Base64.DecodeTableFormat.MIXEDapproach, allowing a seamless handling of bothBase64.DecodeTableFormat.URL_SAFEandBase64.DecodeTableFormat.STANDARDbase64.- Parameters:
format- table format to be used on Base64 decoding. UseBase64.DecodeTableFormat.MIXEDor null to reset to the default behavior.- Returns:
thisinstance.- Since:
- 1.21
-
setEncodeTable
Description copied from class:BaseNCodec.AbstractBuilderSets the encode table.- Overrides:
setEncodeTablein classBaseNCodec.AbstractBuilder<Base64, Base64.Builder>- Parameters:
encodeTable- the encode table, null resets to the default.- Returns:
thisinstance.
-
setUrlSafe
Sets the URL-safe encoding policy.This method does not modify behavior on decoding operations. For configuration of the decoding behavior, please use
Builder.setDecodeTableFormat(DecodeTableFormat)method.- Parameters:
urlSafe- URL-safe encoding policy, null resets to the default.- Returns:
thisinstance.
-