|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.iplanet.jato.util.Encoder
Static utility class for Base64 encoding/decoding a byte array or
Serializable
object with support for compression and escaped HTTP
strings using a variant of Base64 encoding. The Base64 implementation
relies on the sun.misc.*
package included with Sun's
implementation of the Java Platform; there is no guarantee that this
implementation will be used in future versions of this class. The
compression features use the java.util.zip
package. This
class provides static methods only and the default constructor is hidden.
Base64 encoding essentially transforms binary data into ASCII; very helpful
in cases where binary data needs to be stored in documents. In support of
Html documents, a variant of Base64 encoding is used which ensures that
encoded Strings can be stored in HTTP/HTML constructs; these strings are
referred to as Http64 strings in this API.
Decoding Http64 strings
,
Encoding Http64 strings
Method Summary | |
static byte[] |
compress(byte[] in)
Compresses array of bytes. |
static byte[] |
decode(java.lang.String s)
Decodes an Http64 string to an array of bytes using a variant of Base64 encoding. |
static byte[] |
decodeBase64(java.lang.String s)
Decodes a string using Base64 decoding into an array of bytes without compression. |
static byte[] |
decodeHttp64(java.lang.String s)
Decode an Http64 string to an array of bytes using a variant of Base64 encoding. |
static byte[] |
decompress(byte[] in)
Decompressed array of bytes using ZLIB. |
static java.lang.Object |
deserialize(byte[] b,
boolean compressed)
Deserialize or 'reconstitute' an object from an array of bytes, which may be have been previously compressed. |
static java.lang.String |
encode(byte[] bytes)
Encodes an array of bytes into a Http64 string without compression using a variant of Base64 encoding. |
static java.lang.String |
encodeBase64(byte[] bytes)
Encodes an array of bytes into a Base64 string, without compression. |
static java.lang.String |
encodeHttp64(byte[] bytes,
int compressThreshold)
Encodes an array of bytes into a compressed Http64 string using a variant of Base64 encoding, performing compression if the byte array exceeds the length specified by the threshold parameter. |
static byte[] |
serialize(java.io.Serializable o,
boolean compress)
Serialize or 'flatten' an object to an array of bytes with optional compression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.String encode(byte[] bytes)
encodeHttp64(byte[],int)
bytes
- binary data to be encoded, should not be nullpublic static byte[] decode(java.lang.String s)
decodeHttp64(String)
s
- Http64 string to be decodeds.getBytes()
on exception during executionpublic static java.lang.String encodeBase64(byte[] bytes)
bytes
- binary data to be encodedpublic static byte[] decodeBase64(java.lang.String s)
s
- string to be decoded (assumed to be Base64 encoded string)s.getBytes()
on exception during executionpublic static java.lang.String encodeHttp64(byte[] bytes, int compressThreshold)
bytes
- binary data to be encoded, should not be nullcompressThreshold
- compression peformed when byte array exceeds this valuepublic static byte[] decodeHttp64(java.lang.String s)
s
- Http64 string to be decodeds.getBytes()
on exception during executionpublic static byte[] compress(byte[] in)
in
- array of bytes to be compressed (should not be null)public static byte[] decompress(byte[] in)
in
- array of bytes to be decompressed (should not be null)public static byte[] serialize(java.io.Serializable o, boolean compress) throws java.io.IOException
o
- object to be flattened (should be Serializable)compress
- flag indicating need to compress resultspublic static java.lang.Object deserialize(byte[] b, boolean compressed) throws java.io.IOException, java.lang.ClassNotFoundException
b
- array of bytes representing previously serialized objectcompressed
- flag indicating need to decompress bytes first
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |