|
class | InputStream |
|
class | OutputStream |
|
|
static void | main (String[] args) throws IOException |
|
static String | encodeObject (java.io.Serializable serializableObject) |
|
static String | encodeObject (java.io.Serializable serializableObject, int options) |
|
static String | encodeBytes (byte[] source) |
|
static String | encodeBytes (byte[] source, int options) |
|
static String | encodeBytes (byte[] source, int off, int len) |
|
static String | encodeBytes (byte[] source, int off, int len, int options) |
|
static byte[] | decode (byte[] source, int off, int len) |
|
static byte[] | decode (String s) |
|
static Object | decodeToObject (String encodedObject) |
|
Encodes and decodes to and from Base64 notation. The source is based on the work of Robert Harder
I am placing this code in the Public Domain. Do with it as you will. This software comes with no guarantees or warranties but with plenty of well-wishing instead! Please visit http://iharder.net/base64 periodically to check for updates or to contribute improvements.
- Author
- Robert Harder
-
rob@i.nosp@m.hard.nosp@m.er.ne.nosp@m.t
- Version
- 2.0
◆ decode() [1/2]
static byte [] com.premium.Base64.decode |
( |
byte[] |
source, |
|
|
int |
off, |
|
|
int |
len |
|
) |
| |
|
inlinestatic |
Very low-level access to decoding ASCII characters in the form of a byte array. Does not support automatically gunzipping or any other "fancy" features.
- Parameters
-
source | The Base64 encoded data |
off | The offset of where to begin decoding |
len | The length of characters to decode |
- Returns
- decoded data
- Since
- 1.3
◆ decode() [2/2]
static byte [] com.premium.Base64.decode |
( |
String |
s | ) |
|
|
inlinestatic |
Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
- Parameters
-
- Returns
- the decoded data
- Since
- 1.4
◆ decodeToObject()
static Object com.premium.Base64.decodeToObject |
( |
String |
encodedObject | ) |
|
|
inlinestatic |
Attempts to decode Base64 data and deserialize a Java Object within. Returns null
if there was an error.
- Parameters
-
encodedObject | The Base64 data to decode |
- Returns
- The decoded and deserialized object
- Since
- 1.5
◆ encodeBytes() [1/4]
static String com.premium.Base64.encodeBytes |
( |
byte[] |
source | ) |
|
|
inlinestatic |
Encodes a byte array into Base64 notation. Does not GZip-compress data.
- Parameters
-
source | The data to convert |
- Returns
- Since
- 1.4
◆ encodeBytes() [2/4]
static String com.premium.Base64.encodeBytes |
( |
byte[] |
source, |
|
|
int |
off, |
|
|
int |
len |
|
) |
| |
|
inlinestatic |
Encodes a byte array into Base64 notation. Does not GZip-compress data.
- Parameters
-
source | The data to convert |
off | Offset in array where conversion should begin |
len | Length of data to convert |
- Returns
- Since
- 1.4
◆ encodeBytes() [3/4]
static String com.premium.Base64.encodeBytes |
( |
byte[] |
source, |
|
|
int |
off, |
|
|
int |
len, |
|
|
int |
options |
|
) |
| |
|
inlinestatic |
Encodes a byte array into Base64 notation.
Valid options:
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
Note: Technically, this makes your encoding non-compliant.
<p<blockquote>
Example: encodeBytes( myData, Base64.GZIP )
or
Example: encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )
- Parameters
-
source | The data to convert |
off | Offset in array where conversion should begin |
len | Length of data to convert |
options | Specified options |
- Returns
- See also
- Base64::GZIP
-
Base64::DONT_BREAK_LINES
- Since
- 2.0
◆ encodeBytes() [4/4]
static String com.premium.Base64.encodeBytes |
( |
byte[] |
source, |
|
|
int |
options |
|
) |
| |
|
inlinestatic |
Encodes a byte array into Base64 notation.
Valid options:
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
Note: Technically, this makes your encoding non-compliant.
<p<blockquote>
Example: encodeBytes( myData, Base64.GZIP )
or
Example: encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )
- Parameters
-
source | The data to convert |
options | Specified options |
- Returns
- See also
- Base64::GZIP
-
Base64::DONT_BREAK_LINES
- Since
- 2.0
◆ encodeObject() [1/2]
static String com.premium.Base64.encodeObject |
( |
java.io.Serializable |
serializableObject | ) |
|
|
inlinestatic |
Serializes an object and returns the Base64-encoded version of that serialized object. If the object cannot be serialized or there is another error, the method will return null
. The object is not GZip-compressed before being encoded.
- Parameters
-
serializableObject | The object to encode |
- Returns
- The Base64-encoded object
- Since
- 1.4
◆ encodeObject() [2/2]
static String com.premium.Base64.encodeObject |
( |
java.io.Serializable |
serializableObject, |
|
|
int |
options |
|
) |
| |
|
inlinestatic |
Serializes an object and returns the Base64-encoded version of that serialized object. If the object cannot be serialized or there is another error, the method will return null
.
Valid options:
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
Note: Technically, this makes your encoding non-compliant.
<p<blockquote>
Example: encodeObject( myObj, Base64.GZIP )
or
Example: encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )
- Parameters
-
serializableObject | The object to encode |
options | @options Specified options |
- Returns
- The Base64-encoded object
- See also
- Base64::GZIP
-
Base64::DONT_BREAK_LINES
- Since
- 2.0
◆ DECODE
final int com.premium.Base64.DECODE = 0 |
|
static |
◆ DONT_BREAK_LINES
final int com.premium.Base64.DONT_BREAK_LINES = 8 |
|
static |
Don't break lines when encoding (violates strict Base64 specification)
◆ ENCODE
final int com.premium.Base64.ENCODE = 1 |
|
static |
◆ GZIP
final int com.premium.Base64.GZIP = 2 |
|
static |
Specify that data should be gzip-compressed.
◆ NO_OPTIONS
final int com.premium.Base64.NO_OPTIONS = 0 |
|
static |
No options specified. Value is zero.
The documentation for this class was generated from the following file:
- /home/master/Documents/l2/servers/source/l2premium/L2JPremium_GameServer/src/com/premium/Base64.java