public class Base64 extends Object
Base64 provides Base64 encoding/decoding of strings and streams.
NOTE: This is a copy of the original org.apache.jackrabbit.core.util.Base64
class to not introduce a dependency to jackrabbit from the test classes.| Modifier and Type | Method and Description |
|---|---|
static long |
calcEncodedLength(long dataLength)
Calculates the size (i.e.
|
static void |
decode(char[] chars,
int off,
int len,
OutputStream out)
Decode base64 encoded data.
|
static void |
decode(char[] chars,
OutputStream out)
Decode base64 encoded data.
|
static void |
decode(InputStream in,
OutputStream out)
Decode base64 encoded data.
|
static void |
decode(Reader reader,
OutputStream out)
Decode base64 encoded data.
|
static void |
decode(String data,
OutputStream out)
Decode base64 encoded data.
|
static void |
encode(byte[] data,
int off,
int len,
Writer writer)
Outputs base64 representation of the specified data to an
OutputStream. |
static void |
encode(InputStream in,
OutputStream out)
Outputs base64 representation of the specified stream data to an
OutputStream. |
static void |
encode(InputStream in,
Writer writer)
Outputs base64 representation of the specified stream data to an
OutputStream. |
static long |
guessDecodedLength(long encLength)
Pessimistically guesses the size (i.e.
|
public static long calcEncodedLength(long dataLength)
dataLength - length (i.e. number of bytes) of the data to be encodedpublic static long guessDecodedLength(long encLength)
encLength - length (i.e. number of bytes) of the base64 encoded datapublic static void encode(InputStream in, Writer writer) throws IOException
OutputStream.in - stream data to be encodedwriter - writer to output the encoded dataIOExceptionpublic static void encode(InputStream in, OutputStream out) throws IOException
OutputStream.in - stream data to be encodedout - stream where the encoded data should be written toIOExceptionpublic static void encode(byte[] data,
int off,
int len,
Writer writer)
throws IOException
OutputStream.data - data to be encodedoff - offset within data at which to start encodinglen - length of data to encodewriter - writer to output the encoded dataIOExceptionpublic static void decode(Reader reader, OutputStream out) throws IOException
reader - reader for the base64 encoded data to be decodedout - stream where the decoded data should be written toIOExceptionpublic static void decode(InputStream in, OutputStream out) throws IOException
in - inputstream of the base64 encoded data to be decodedout - stream where the decoded data should be written toIOExceptionpublic static void decode(String data, OutputStream out) throws IOException
data - the base64 encoded data to be decodedout - stream where the decoded data should be written toIOExceptionpublic static void decode(char[] chars,
OutputStream out)
throws IOException
chars - the base64 encoded data to be decodedout - stream where the decoded data should be written toIOExceptionpublic static void decode(char[] chars,
int off,
int len,
OutputStream out)
throws IOException
chars - the base64 encoded data to be decodedoff - offset within data at which to start decodinglen - length of data to decodeout - stream where the decoded data should be written toIOExceptionCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.