public final class EncodingTools
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
base64toByteArray(java.lang.String input)
Decodes a base64 encoded String.
|
static byte[] |
base64toByteArray(java.lang.String input,
java.lang.String charset)
Decodes a base64 encoded String into a byte[].
|
static java.io.InputStream |
base64toStream(java.lang.String input)
Decodes a base64 encoded String into an InputStream.
|
static java.io.InputStream |
base64toStream(java.lang.String input,
java.lang.String charset)
Decodes a base64 encoded String into an InputStream.
|
static java.lang.String |
base64toString(java.lang.String input)
Encodes the data of an InputStream a String using the given encoder.
|
static java.lang.String |
base64toString(java.lang.String input,
java.lang.String charset)
Decodes a base64 encoded String.
|
static byte[] |
decode(byte[] input,
BinaryDecoder decoder)
Decodes a String using a decoder into a byte[9.
|
static java.lang.String |
decode(java.lang.String input,
BinaryDecoder decoder)
Decodes a String using a decoder.
|
static java.lang.String |
decode(java.lang.String input,
BinaryDecoder decoder,
java.nio.charset.Charset charset)
Decodes a String using a decoder.
|
static byte[] |
encode(byte[] input,
BinaryEncoder encoder)
Encodes a byte[] using the given encoder.
|
static java.lang.String |
encode(java.lang.String input,
BinaryEncoder encoder)
Encodes a String using the given encoder.
|
static java.lang.String |
encode(java.lang.String input,
BinaryEncoder encoder,
java.nio.charset.Charset charset)
Encodes a String using the given encoder.
|
static java.lang.String |
toBase64(byte[] bytes)
Encodes a byte[] with base64.
|
static java.lang.String |
toBase64(java.io.InputStream in)
Encodes the data of an InputStream with base64.
|
static java.lang.String |
toBase64(java.lang.String input)
Encodes a String with base64.
|
static java.lang.String |
toBase64(java.lang.String input,
java.lang.String charset)
Encodes a String with base64.
|
public static java.lang.String toBase64(java.lang.String input)
throws java.io.IOException
input - the string to encode. The String is expected to be a UTF-8 String.java.io.IOExceptionpublic static java.lang.String toBase64(java.lang.String input,
java.lang.String charset)
throws java.io.IOException
input - the string to encode.charset - charset of the String (e.g. UTF-8)java.io.IOExceptionpublic static java.lang.String toBase64(byte[] bytes)
throws java.io.IOException
bytes - the byte[] to encodejava.io.IOExceptionpublic static java.lang.String toBase64(java.io.InputStream in)
throws java.io.IOException
in - the InputStream to encodejava.io.IOExceptionpublic static java.lang.String encode(java.lang.String input,
BinaryEncoder encoder)
throws EncoderException
input - the String to encode. The String is expected to be a UTF-8 String.encoder - an encoder (see org.apache.commons.codec)EncoderExceptionpublic static java.lang.String encode(java.lang.String input,
BinaryEncoder encoder,
java.nio.charset.Charset charset)
throws EncoderException
input - input the String to encodeencoder - an encoder (see org.apache.commons.codec)charset - the charset of the stringEncoderExceptionpublic static byte[] encode(byte[] input,
BinaryEncoder encoder)
throws EncoderException
input - the byte[] to encodeencoder - an encoder (see org.apache.commons.codec)EncoderExceptionpublic static java.lang.String base64toString(java.lang.String input)
throws java.io.IOException
input - the InputStream to encodejava.io.IOExceptionpublic static java.lang.String base64toString(java.lang.String input,
java.lang.String charset)
throws java.io.IOException
input - the base64 encoded Stringcharset - charset of the Stringjava.io.IOExceptionpublic static byte[] base64toByteArray(java.lang.String input)
throws java.io.IOException
input - java.io.IOExceptionpublic static byte[] base64toByteArray(java.lang.String input,
java.lang.String charset)
throws java.io.IOException
input - the base64 encoded Stringcharset - charset of the stringjava.io.IOExceptionpublic static java.io.InputStream base64toStream(java.lang.String input)
throws java.io.IOException
input - the base64 encoded Stringjava.io.IOExceptionpublic static java.io.InputStream base64toStream(java.lang.String input,
java.lang.String charset)
throws java.io.IOException
input - the base64 encoded Stringcharset - the charset of the Stringjava.io.IOExceptionpublic static java.lang.String decode(java.lang.String input,
BinaryDecoder decoder)
throws DecoderException
input - the String to decodedecoder - a decoder (see org.apache.commons.codec)DecoderExceptionpublic static java.lang.String decode(java.lang.String input,
BinaryDecoder decoder,
java.nio.charset.Charset charset)
throws DecoderException
input - the String to decodedecoder - a decoder (see org.apache.commons.codec)charset - the charset of the StringDecoderExceptionpublic static byte[] decode(byte[] input,
BinaryDecoder decoder)
throws DecoderException
input - the String to decodedecoder - decoder a decoder (see org.apache.commons.codec)DecoderException