| java.lang.Object org.araneaframework.http.util.EncodingUtil
EncodingUtil | abstract public class EncodingUtil (Code) | | Provides base64 encoding, decoding methods, generating a digest and checking the digest methods.
author: "Toomas Römer" |
Method Summary | |
public static byte[] | buildDigest(byte[] data) Builds a digest of the byte array, using the SHA hash function.
Parameters: data - the byte array that's digest we are building. | public static boolean | checkDigest(byte[] value, byte[] digest) Returns true, if the digest of the value equals to the given digest.
Parameters: value - byte array that's digest we are comparing. | public static Object | decodeObjectBase64(String value, boolean compress) Base64 decodes the value, optionally decompresses it and then deserializes it. | public static String | encodeObjectBase64(Serializable object, boolean compress) The method serializes the object, optionally compresses it and base64 encodes. |
buildDigest | public static byte[] buildDigest(byte[] data) throws Exception(Code) | | Builds a digest of the byte array, using the SHA hash function.
Parameters: data - the byte array that's digest we are building. A byte[] array representing the SHA hash. throws: Exception - |
checkDigest | public static boolean checkDigest(byte[] value, byte[] digest) throws Exception(Code) | | Returns true, if the digest of the value equals to the given digest.
Parameters: value - byte array that's digest we are comparing. Parameters: digest - the allready generated digest we are comparing against. true if the digest of the value equals digest, otherwise false. throws: Exception - |
decodeObjectBase64 | public static Object decodeObjectBase64(String value, boolean compress) throws Exception(Code) | | Base64 decodes the value, optionally decompresses it and then deserializes it. For
the decompression GZip is expected.
Parameters: value - is the base64 encoded data of the optionally compressed serialized object. Parameters: compress - determines if after the decoding gzip decompression should be applied. an Object that is deserialized object of the decoded optionally decompressed value. throws: Exception - |
encodeObjectBase64 | public static String encodeObjectBase64(Serializable object, boolean compress) throws Exception(Code) | | The method serializes the object, optionally compresses it and base64 encodes.
GZip is used for the optional compression.
The method uses streams for the different operations and the underlying base64
algorithm is from iHarder.net base64 utilities..
Parameters: object - that will be encoded. Parameters: compress - if set, the serialized object will be compressed. A String represtation of the object in base64 encoded format. throws: Exception - |
|
|