public final class Base64Decoding extends Object
| Constructor and Description |
|---|
Base64Decoding() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decode(byte[] source)
Low-level access to decoding ASCII characters in the form of a byte array.
|
static byte[] |
decode(byte[] source,
int off,
int len,
int options)
Low-level access to decoding ASCII characters in the form of a byte array.
|
static byte[] |
decode(String s)
Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
|
static byte[] |
decode(String s,
int options)
Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
|
static void |
decodeFileToFile(String infile,
String outfile)
Reads infile and decodes it to outfile.
|
static byte[] |
decodeFromFile(String filename)
Convenience method for reading a base64-encoded file and decoding it.
|
static void |
decodeToFile(String dataToDecode,
String filename)
Convenience method for decoding data to a file.
|
static Object |
decodeToObject(String encodedObject)
Attempts to decode Base64 data and deserialize a Java Object within.
|
static Object |
decodeToObject(String encodedObject,
int options,
ClassLoader loader)
Attempts to decode Base64 data and deserialize a Java Object within.
|
static void |
encodeFileToFile(String infile,
String outfile)
Reads infile and encodes it to outfile.
|
static String |
encodeFromFile(String filename)
Convenience method for reading a binary file and base64-encoding it.
|
static void |
encodeToFile(byte[] dataToEncode,
String filename)
Convenience method for encoding data to a file.
|
public static byte[] decode(byte[] source)
throws IOException
source - The Base64 encoded dataIOException - if any I/O error occurs.public static byte[] decode(byte[] source,
int off,
int len,
int options)
throws IOException
source - The Base64 encoded dataoff - The offset of where to begin decodinglen - The length of characters to decodeoptions - Can specify options such as alphabet type to useIOException - If bogus characters exist in source datapublic static byte[] decode(String s) throws IOException
s - the string to decodeIOException - If there is a problempublic static byte[] decode(String s, int options) throws IOException
s - the string to decodeoptions - encode options such as URL_SAFEIOException - if there is an errorNullPointerException - if s is nullpublic static Object decodeToObject(String encodedObject) throws IOException, ClassNotFoundException
encodedObject - The Base64 data to decodeNullPointerException - if encodedObject is nullIOException - if there is a general errorClassNotFoundException - if the decoded object is of a class that cannot be found by the JVMpublic static Object decodeToObject(String encodedObject, int options, ClassLoader loader) throws IOException, ClassNotFoundException
encodedObject - The Base64 data to decodeoptions - Various parameters related to decodingloader - Optional class loader to use in deserializing classes.NullPointerException - if encodedObject is nullIOException - if there is a general errorClassNotFoundException - if the decoded object is of a class that cannot be found by the JVMpublic static void encodeToFile(byte[] dataToEncode,
String filename)
throws IOException
As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
dataToEncode - byte array of data to encode in base64 formfilename - Filename for saving encoded dataIOException - if there is an errorNullPointerException - if dataToEncode is nullpublic static void decodeToFile(String dataToDecode, String filename) throws IOException
As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
dataToDecode - Base64-encoded data as a stringfilename - Filename for saving decoded dataIOException - if there is an errorpublic static byte[] decodeFromFile(String filename) throws IOException
As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
filename - Filename for reading encoded dataIOException - if there is an errorpublic static String encodeFromFile(String filename) throws IOException
As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
filename - Filename for reading binary dataIOException - if there is an errorpublic static void encodeFileToFile(String infile, String outfile) throws IOException
infile - Input fileoutfile - Output fileIOException - if there is an errorpublic static void decodeFileToFile(String infile, String outfile) throws IOException
infile - Input fileoutfile - Output fileIOException - if there is an errorCopyright © 2005-2012 JPPF Team.