HDIV API 2.0.4

org.hdiv.util
Class EncodingUtil

java.lang.Object
  extended by org.hdiv.util.EncodingUtil

public class EncodingUtil
extends java.lang.Object

Class containing utility methods for encoding.

Author:
Roberto Velasco, Gorka Vicente

Field Summary
static java.lang.String ZIP_CHARSET
          Name of a supported charset
 
Constructor Summary
EncodingUtil()
           
 
Method Summary
 java.lang.String calculateStateHash(java.lang.String data)
          Calculate data hash value.
 java.lang.Object decode64(java.lang.String s)
          Decodes Base64 alphabet characters of the string s and decompresses it.
 java.lang.Object decode64Cipher(java.lang.String s)
          Decodes Base64 alphabet characters of the string s, decrypts this string and finally decompresses it.
 java.lang.String encode64(java.lang.Object obj)
          The object obj is compressed and coded in Base64.
 java.lang.String encode64Cipher(java.lang.Object obj)
          The object obj is compressed, encrypted and coded in Base64.
 ISession getSession()
           
 void init()
          Initialize the EncodingUtil with Http Session and message resource.
 void initTesting()
          Initialize the EncodingUtil with message resource.
 void setAlgorithmName(java.lang.String algorithmName)
           
 void setMessageDigest(java.security.MessageDigest md)
           
 void setSession(ISession session)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZIP_CHARSET

public static final java.lang.String ZIP_CHARSET
Name of a supported charset

See Also:
Constant Field Values
Constructor Detail

EncodingUtil

public EncodingUtil()
Method Detail

init

public void init()
Initialize the EncodingUtil with Http Session and message resource.


initTesting

public void initTesting()
Initialize the EncodingUtil with message resource.


encode64Cipher

public java.lang.String encode64Cipher(java.lang.Object obj)
The object obj is compressed, encrypted and coded in Base64.

Parameters:
obj - Object to encrypt
Returns:
Objet obj compressed, encrypted and coded in Base64
Throws:
HDIVException - if there is an error encoding object data
See Also:
GZIPOutputStream.GZIPOutputStream(java.io.OutputStream), URLCodec.encodeUrl(java.util.BitSet, byte[]), Base64.encode(byte[])

decode64Cipher

public java.lang.Object decode64Cipher(java.lang.String s)
Decodes Base64 alphabet characters of the string s, decrypts this string and finally decompresses it.

Parameters:
s - data to decrypt
Returns:
decoded data
Throws:
HDIVException - if there is an error decoding object data
See Also:
Base64.decode(byte[]), URLCodec.decode(byte[]), GZIPInputStream.GZIPInputStream(java.io.InputStream)

encode64

public java.lang.String encode64(java.lang.Object obj)
The object obj is compressed and coded in Base64.

Parameters:
obj - Object to encode
Returns:
Object obj compressed y encoded in Base64
Throws:
HDIVException - if there is an error encoding object data
See Also:
GZIPOutputStream.GZIPOutputStream(java.io.OutputStream), URLCodec.encodeUrl(java.util.BitSet, byte[]), Base64.encode(byte[])

decode64

public java.lang.Object decode64(java.lang.String s)
Decodes Base64 alphabet characters of the string s and decompresses it.

Parameters:
s - data to decode
Returns:
decoded s string
Throws:
HDIVException - if there is an error decoding object data
See Also:
Base64.decode(byte[]), URLCodec.decode(byte[]), GZIPInputStream.GZIPInputStream(java.io.InputStream)

calculateStateHash

public java.lang.String calculateStateHash(java.lang.String data)
Calculate data hash value.

Parameters:
data - data
Returns:
data hash value

getSession

public ISession getSession()
Returns:
Returns the session.

setSession

public void setSession(ISession session)
Parameters:
session - The session to set.

setMessageDigest

public void setMessageDigest(java.security.MessageDigest md)
Parameters:
md - The message digest to set.

setAlgorithmName

public void setAlgorithmName(java.lang.String algorithmName)
Parameters:
algorithm - The algorithm to set for the message digest.

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.