SecurePlayLibray J2SE
v2.1

com.SecurePlay
Class SPUBinaryCodingClass

java.lang.Object
  extended bycom.SecurePlay.SPUBinaryCodingClass

public class SPUBinaryCodingClass
extends java.lang.Object

This class is used to serialize and deserialize SPMessageClass objects into binary encoded messages.

Author:
IT GlobalSecure Inc.
See Also:
SecurePlay License Information
 

Field Summary
(package private) static int BMAXMESSAGEBODYLENGTH
          maximum message body length
(package private) static int BMAXMESSAGEBODYPARTLENGTH
          maximum message body part length
(package private) static int BMAXMESSAGEBODYPARTS
          maximum number of body parts
static int BMAXMESSAGESLENGTH
          maximum total messages length
static int BMAXNAMELENGTH
          number of characters lenght allowed in a name
static int BMAXNUMMESSAGELENGTH
          maximum number of messages
static int BMAXRECEIVERCOUNT
          number of receivers allowed
static int BMAXRECEIVERSLENGTH
          maximum total recievers length
(package private) static int BMAXSIGNLENGTH
          maximum signature length
static int BMAXSINGLEMESSLENGTH
          maximum length of one messages
static int MULTIMESSAGE
           
static int ONEMESSAGE
          tags that are used to indicate wether the message contains multiple or single message
static int RELAYMESSAGE
          tag used to indicate that the following two messages are doubple.
 
Constructor Summary
SPUBinaryCodingClass()
           
 
Method Summary
static SPMessageClass[] addMessArrEl(SPMessageClass[] messes, SPMessageClass mess)
          This is a private method used only in multiple message deserialization method.
static java.lang.String[] decodeStringArr(byte[] btArr, int MAXEntryLength, int MAXnumElem, int MAXarrLen)
          This method deserializes a string array form byte array.
static byte[] encodeStringArr(java.lang.String[] strArr, int MAXElemLength, int MAXnumElem, int MAXarrLen)
          This method is used to serialize a string array into byte array.
static SPMessageClass[] SPdeserialize(byte[] mess)
          This method deserializes multiple messages from binary to Message ojects.
static SPMessageClass[] SPdeserializeDouble(byte[] mess)
          Deserializes two messages for double message.
static byte[] SPseralizeByteArr(java.util.Vector byteMessages)
          This method serializes messages of byte arrays in to one big byte array.
static byte[] SPserialize(SPMessageClass message)
           
static byte[] SPserialize(SPMessageClass[] messages)
          This method takes several instances of the SPMessageClass and serializes it into byte array.
static byte[] SPserializeDouble(SPMessageClass primary, SPMessageClass alt)
          Serializes two messages for double message.
static byte[] SPserializesingle(SPMessageClass message)
          This method takes an instance of the SPMessageClass and serializes it into a byte array.
static SPMessageClass SPsingledeserialize(byte[] mess)
          This method takes a single serialized message and turns it into an instance of the SPMessageClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONEMESSAGE

public static final int ONEMESSAGE
tags that are used to indicate wether the message contains multiple or single message

See Also:
Constant Field Values

MULTIMESSAGE

public static final int MULTIMESSAGE
See Also:
Constant Field Values

RELAYMESSAGE

public static final int RELAYMESSAGE
tag used to indicate that the following two messages are doubple.

See Also:
Constant Field Values

BMAXMESSAGESLENGTH

public static final int BMAXMESSAGESLENGTH
maximum total messages length

See Also:
Constant Field Values

BMAXNUMMESSAGELENGTH

public static final int BMAXNUMMESSAGELENGTH
maximum number of messages

See Also:
Constant Field Values

BMAXSINGLEMESSLENGTH

public static final int BMAXSINGLEMESSLENGTH
maximum length of one messages

See Also:
Constant Field Values

BMAXRECEIVERCOUNT

public static final int BMAXRECEIVERCOUNT
number of receivers allowed

See Also:
Constant Field Values

BMAXRECEIVERSLENGTH

public static final int BMAXRECEIVERSLENGTH
maximum total recievers length

See Also:
Constant Field Values

BMAXNAMELENGTH

public static final int BMAXNAMELENGTH
number of characters lenght allowed in a name

See Also:
Constant Field Values

BMAXMESSAGEBODYPARTS

static final int BMAXMESSAGEBODYPARTS
maximum number of body parts

See Also:
Constant Field Values

BMAXMESSAGEBODYPARTLENGTH

static final int BMAXMESSAGEBODYPARTLENGTH
maximum message body part length

See Also:
Constant Field Values

BMAXMESSAGEBODYLENGTH

static final int BMAXMESSAGEBODYLENGTH
maximum message body length

See Also:
Constant Field Values

BMAXSIGNLENGTH

static final int BMAXSIGNLENGTH
maximum signature length

See Also:
Constant Field Values
Constructor Detail

SPUBinaryCodingClass

public SPUBinaryCodingClass()
Method Detail

SPserialize

public static byte[] SPserialize(SPMessageClass message)

SPserialize

public static byte[] SPserialize(SPMessageClass[] messages)
This method takes several instances of the SPMessageClass and serializes it into byte array.

Parameters:
messages - SPMessageClass[] - a message to be seriealized into byte array
Returns:
mess - byte[] - the serialized byte array of all the messages.

SPserializesingle

public static byte[] SPserializesingle(SPMessageClass message)
This method takes an instance of the SPMessageClass and serializes it into a byte array.

Parameters:
message - SPMessageClass - a message to be seriealized into binary array
Returns:
mess - byte[] - the serialized byte array of the message

SPdeserialize

public static SPMessageClass[] SPdeserialize(byte[] mess)
This method deserializes multiple messages from binary to Message ojects.

Parameters:
mess - byte[] - byte array that contains the messages.
Returns:
messages - SPMessageClass[] - messages that were deserialized from the byte array.

SPsingledeserialize

public static SPMessageClass SPsingledeserialize(byte[] mess)
This method takes a single serialized message and turns it into an instance of the SPMessageClass

Parameters:
mess - byte[] - serialized message object
Returns:
messobj - SPMessageClass - an instance of SPMessageClass

encodeStringArr

public static byte[] encodeStringArr(java.lang.String[] strArr,
                                     int MAXElemLength,
                                     int MAXnumElem,
                                     int MAXarrLen)
This method is used to serialize a string array into byte array.

Parameters:
strArr - String[] - the string array to be seralized
Returns:
strArrser - byte[] - serializedstring array.

decodeStringArr

public static java.lang.String[] decodeStringArr(byte[] btArr,
                                                 int MAXEntryLength,
                                                 int MAXnumElem,
                                                 int MAXarrLen)
This method deserializes a string array form byte array.

Parameters:
btArr - byte[] - byte array to be deserialized.
Returns:
strArr - String[] - deserialized string array.

addMessArrEl

public static SPMessageClass[] addMessArrEl(SPMessageClass[] messes,
                                            SPMessageClass mess)
This is a private method used only in multiple message deserialization method. It takes an array of SPAbstractMessageClasses and safely adds another one.

Parameters:
messes - SPAbstractMessage[] - the array to which the new message will be added.
mess - SPMessageClass - the message class to be added.
Returns:
messages - SPAbstractMessage[] - message array with the new added message.

SPserializeDouble

public static byte[] SPserializeDouble(SPMessageClass primary,
                                       SPMessageClass alt)
Serializes two messages for double message. Used only to send relay messages.

Parameters:
primary - SPMessageClass - primary message.
alt - SPMessageClass - alternative message.
Returns:
byte[]

SPdeserializeDouble

public static SPMessageClass[] SPdeserializeDouble(byte[] mess)
Deserializes two messages for double message. Used only to recieve relay messages.

Parameters:
mess - byte[] - serialized double message.
Returns:
SPMessageClass[]

SPseralizeByteArr

public static byte[] SPseralizeByteArr(java.util.Vector byteMessages)
This method serializes messages of byte arrays in to one big byte array.

Parameters:
byteMessages - Vector - byte[] messages to be serialized.
Returns:
byte[]

SecurePlayLibray J2SE
v2.1

2006 Copyright Filed by IT GlobalSecure, Inc. All Rights Reserved. Not to be used without authorization by Author. SecurePlay, IT GlobalSecure, and IT Armor are registered trademarks by IT GlobalSecure, Inc. Software protected by software license, and one or more the following U.S. and International patent numbers: U.S. Patent 6,030,288, U.S. Patent 6,165,072, European Patent Office EP1016049A1,and World Intellectual Property Organization WO9912135C1 and additional filings worldwide.