public class Base64
extends java.lang.Object
TransformBase64Decode
Modifier and Type | Field and Description |
---|---|
static int |
BASE64DEFAULTLENGTH
Field BASE64DEFAULTLENGTH
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(java.io.BufferedReader reader)
Base64 decode the lines from the reader and return an InputStream
with the bytes.
|
static byte[] |
decode(byte[] base64)
Method decode
|
static void |
decode(byte[] base64Data,
java.io.OutputStream os)
Decodes Base64 data into outputstream
|
protected static void |
decode(byte[] base64Data,
java.io.OutputStream os,
int len) |
static byte[] |
decode(org.w3c.dom.Element element)
Method decode
Takes the
Text children of the Element and interprets
them as input for the Base64.decode() function. |
static void |
decode(java.io.InputStream is,
java.io.OutputStream os)
Decodes Base64 data into outputstream
|
static byte[] |
decode(java.lang.String encoded)
Decodes Base64 data into octets
|
static void |
decode(java.lang.String base64Data,
java.io.OutputStream os)
Decodes Base64 data into outputstream
|
static java.math.BigInteger |
decodeBigIntegerFromElement(org.w3c.dom.Element element)
Method decodeBigIntegerFromElement
|
static java.math.BigInteger |
decodeBigIntegerFromText(org.w3c.dom.Text text)
Method decodeBigIntegerFromText
|
protected static byte[] |
decodeInternal(byte[] base64Data,
int len) |
static java.lang.String |
encode(java.math.BigInteger big)
Encode in Base64 the given
|
static byte[] |
encode(java.math.BigInteger big,
int bitlen)
Returns a byte-array representation of a
|
static java.lang.String |
encode(byte[] binaryData)
Encode a byte array and fold lines at the standard 76th character unless
ignore line breaks property is set.
|
static java.lang.String |
encode(byte[] binaryData,
int length)
Encode a byte array in Base64 format and return an optionally
wrapped line.
|
static org.w3c.dom.Element |
encodeToElement(org.w3c.dom.Document doc,
java.lang.String localName,
byte[] bytes)
Method encodeToElement
|
static void |
fillElementWithBigInteger(org.w3c.dom.Element element,
java.math.BigInteger biginteger)
This method takes an (empty) Element and a BigInteger and adds the
base64 encoded BigInteger to the Element.
|
protected static int |
getBytesInternal(java.lang.String s,
byte[] result) |
protected static boolean |
isPad(byte octect) |
protected static boolean |
isWhiteSpace(byte octect) |
protected static int |
removeWhiteSpace(byte[] data)
remove WhiteSpace from MIME containing encoded Base64 data.
|
public static final int BASE64DEFAULTLENGTH
public static final java.lang.String encode(java.math.BigInteger big)
BigInteger
.
big
- public static final byte[] encode(java.math.BigInteger big, int bitlen)
BigInteger
.
No sign-bit is output.
N.B.: BigInteger
's toByteArray
returns eventually longer arrays because of the leading sign-bit.
big
- BigInteger to be converted
bitlen
- int the desired length in bits of the representation
bitlen
bits of big
public static final java.math.BigInteger decodeBigIntegerFromElement(org.w3c.dom.Element element) throws Base64DecodingException
element
- Base64DecodingException
public static final java.math.BigInteger decodeBigIntegerFromText(org.w3c.dom.Text text) throws Base64DecodingException
text
- Base64DecodingException
public static final void fillElementWithBigInteger(org.w3c.dom.Element element, java.math.BigInteger biginteger)
element
- biginteger
- public static final byte[] decode(org.w3c.dom.Element element) throws Base64DecodingException
Text
children of the Element and interprets
them as input for the Base64.decode()
function.element
- Base64DecodingException
public static final org.w3c.dom.Element encodeToElement(org.w3c.dom.Document doc, java.lang.String localName, byte[] bytes)
doc
- localName
- bytes
- public static final byte[] decode(byte[] base64) throws Base64DecodingException
base64
- Base64DecodingException
public static final java.lang.String encode(byte[] binaryData)
binaryData
- byte[] to be base64 encoded
String with encoded data
public static final byte[] decode(java.io.BufferedReader reader) throws java.io.IOException, Base64DecodingException
reader
- java.io.IOException
- passes what the reader throwsjava.io.IOException
Base64DecodingException
protected static final boolean isWhiteSpace(byte octect)
protected static final boolean isPad(byte octect)
public static final java.lang.String encode(byte[] binaryData, int length)
binaryData
- byte[]
data to be encodedlength
- int length of wrapped lines; No wrapping if less than 4.
String
with encoded datapublic static final byte[] decode(java.lang.String encoded) throws Base64DecodingException
encoded
- String containing base64 encoded dataBase64DecodingException
- if there is a problem decoding the dataprotected static final int getBytesInternal(java.lang.String s, byte[] result)
protected static final byte[] decodeInternal(byte[] base64Data, int len) throws Base64DecodingException
Base64DecodingException
public static final void decode(java.lang.String base64Data, java.io.OutputStream os) throws Base64DecodingException, java.io.IOException
base64Data
- String containing Base64 dataos
- the outputstreamjava.io.IOException
Base64DecodingException
public static final void decode(byte[] base64Data, java.io.OutputStream os) throws Base64DecodingException, java.io.IOException
base64Data
- Byte array containing Base64 dataos
- the outputstreamjava.io.IOException
Base64DecodingException
protected static final void decode(byte[] base64Data, java.io.OutputStream os, int len) throws Base64DecodingException, java.io.IOException
Base64DecodingException
java.io.IOException
public static final void decode(java.io.InputStream is, java.io.OutputStream os) throws Base64DecodingException, java.io.IOException
is
- containing Base64 dataos
- the outputstreamjava.io.IOException
Base64DecodingException
protected static final int removeWhiteSpace(byte[] data)
data
- the byte array of base64 data (with WS)