com.businesslink.sgi.api.hsm
Class HsmData

java.lang.Object
  |
  +--com.businesslink.sgi.api.hsm.HsmData

public final class HsmData
extends java.lang.Object
implements java.lang.Cloneable

Class used to store all HSM request and reply data.


Constructor Summary
HsmData()
           
HsmData(int initialDataSpace)
           
 
Method Summary
protected  java.lang.Object clone()
          Clones this HsmData object.
 void dump(java.io.PrintWriter wtr, java.lang.String lbl)
          Displays the contents of this HsmData object to the specified PrintWriter.
 char[] getChars()
          Gets all valid HSM data from the internal HSM data buffer.
 char[] getChars(int start)
          Gets data from the internal HSM data buffer.
 char[] getChars(int start, int length)
          Gets data from the internal HSM data buffer.
 char[] getCharsNext()
          Gets all remaining data from the internal HSM data buffer based on the last get method call.
 char[] getCharsNext(int length)
          Gets remaining data from the internal HSM data buffer based on the last get method call.
 java.lang.String getOpcode()
          Gets the opcode.
 int getPosition()
          Gets the value of the internal position variable.
 java.lang.String getString()
          Gets all valid HSM data from the internal HSM data buffer.
 java.lang.String getString(int start)
          Gets data from the internal HSM data buffer.
 java.lang.String getString(int start, int length)
          Gets data from the internal HSM data buffer.
 java.lang.StringBuffer getStringBuffer()
          Gets all valid HSM data from the internal HSM data buffer.
 java.lang.StringBuffer getStringBuffer(int start)
          Gets data from the internal HSM data buffer.
 java.lang.StringBuffer getStringBuffer(int start, int length)
          Gets data from the internal HSM data buffer.
 java.lang.StringBuffer getStringBufferNext()
          Gets all remaining data from the internal HSM data buffer based on the last get method call.
 java.lang.StringBuffer getStringBufferNext(int length)
          Gets remaining data from the internal HSM data buffer based on the last get method call.
 java.lang.String getStringNext()
          Gets all remaining data from the internal HSM data buffer based on the last get method call.
 java.lang.String getStringNext(int length)
          Gets remaining data from the internal HSM data buffer based on the last get method call.
 int length()
          Returns the length of the valid HSM data contained in this HsmData object.
 int remaining()
          Returns the remaining number of valid data characters based on the current position.
 void reset()
          Resets this HsmData object, clearing all internal data.
 void setData(char[] data)
          Sets data in the internal HSM data buffer.
 void setData(int start, char[] data)
          Sets data in the internal HSM data buffer.
 void setData(int start, int length, char[] data)
          Sets data in the internal HSM data buffer.
 void setData(int start, int length, java.lang.String data)
          Sets data in the internal HSM data buffer.
 void setData(int start, int length, java.lang.StringBuffer data)
          Sets data in the internal HSM data buffer.
 void setData(int start, java.lang.String data)
          Sets data in the internal HSM data buffer.
 void setData(int start, java.lang.StringBuffer data)
          Sets data in the internal HSM data buffer.
 void setData(java.lang.String data)
          Sets data in the internal HSM data buffer.
 void setData(java.lang.StringBuffer data)
          Sets data in the internal HSM data buffer.
 void setDataNext(char[] data)
          Sets data in the internal HSM data buffer based on the last setData method call.
 void setDataNext(int length, char[] data)
          Sets data in the internal HSM data buffer based on the last setData method call.
 void setDataNext(int length, java.lang.String data)
          Sets data in the internal HSM data buffer based on the last setData method call.
 void setDataNext(int length, java.lang.StringBuffer data)
          Sets data in the internal HSM data buffer based on the last setData method call.
 void setDataNext(java.lang.String data)
          Sets data in the internal HSM data buffer based on the last setData method call.
 void setDataNext(java.lang.StringBuffer data)
          Sets data in the internal HSM data buffer based on the last setData method call.
 void setOpcode(java.lang.String opc)
          Sets the opcode.
 void setPosition(int pos)
          Sets the value of the internal position variable.
 int unused()
          Returns the length of the unused HSM data in this HsmData object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HsmData

public HsmData()

HsmData

public HsmData(int initialDataSpace)
Parameters:
initialDataSpace - the initial size of the internal character array.
Method Detail

clone

protected java.lang.Object clone()
Clones this HsmData object.
Overrides:
clone in class java.lang.Object
Returns:
a clone of this HsmData object.

reset

public void reset()
Resets this HsmData object, clearing all internal data.

length

public int length()
Returns the length of the valid HSM data contained in this HsmData object. The length is equal to the number of valid data characters in the internal buffer.
Returns:
the length of the valid HSM data.

unused

public int unused()
Returns the length of the unused HSM data in this HsmData object. The length is equal to the maximum size of the internal buffer minus the current number of valid data characters.
Returns:
the length of the unused HSM data.

remaining

public int remaining()
Returns the remaining number of valid data characters based on the current position.
Returns:
the remaining number of valid data characters.

getPosition

public int getPosition()
Gets the value of the internal position variable. Note that this value is 1-based, not 0-based, so the first character of the HSM data is at position 1.
Returns:
the current position.

setPosition

public void setPosition(int pos)
Sets the value of the internal position variable. Note that this value is 1-based, not 0-based, so the first character of the HSM data is at position 1.
Parameters:
pos - the new position.

dump

public void dump(java.io.PrintWriter wtr,
                 java.lang.String lbl)
Displays the contents of this HsmData object to the specified PrintWriter.
Parameters:
wtr - the PrintWriter to write to.
lbl - a label identifying this dump (usually "REQUEST" or "REPLY").

setOpcode

public void setOpcode(java.lang.String opc)
Sets the opcode.
Parameters:
opc - the opcode to set.

getOpcode

public java.lang.String getOpcode()
Gets the opcode.
Returns:
the current opcode.

setData

public void setData(char[] data)
Sets data in the internal HSM data buffer. All previous content is overwritten. The internal position variable is set to the end of the data just written.
Parameters:
data - the data to set.

setData

public void setData(java.lang.String data)
Sets data in the internal HSM data buffer. All previous content is overwritten. The internal position variable is set to the end of the data just written.
Parameters:
data - the data to set.

setData

public void setData(java.lang.StringBuffer data)
Sets data in the internal HSM data buffer. All previous content is overwritten. The internal position variable is set to the end of the data just written.
Parameters:
data - the data to set.

setData

public void setData(int start,
                    char[] data)
Sets data in the internal HSM data buffer. The write to the internal buffer starts at the specified position and continues for the length of the data. The internal position variable is set to the end of the data just written.
Parameters:
start - the starting position in the HSM data buffer.
data - the data to set.

setData

public void setData(int start,
                    java.lang.String data)
Sets data in the internal HSM data buffer. The write to the internal buffer starts at the specified position and continues for the length of the data. The internal position variable is set to the end of the data just written.
Parameters:
start - the starting position in the HSM data buffer.
data - the data to set.

setData

public void setData(int start,
                    java.lang.StringBuffer data)
Sets data in the internal HSM data buffer. The write to the internal buffer starts at the specified position and continues for the length of the data. The internal position variable is set to the end of the data just written.
Parameters:
start - the starting position in the HSM data buffer.
data - the data to set.

setData

public void setData(int start,
                    int length,
                    char[] data)
Sets data in the internal HSM data buffer. The write to the internal buffer starts at the specified position and continues for the specified length. The internal position variable is set to the end of the data just written.
Parameters:
start - the starting position in the HSM data buffer.
length - the number of characters to set.
data - the data to set.

setData

public void setData(int start,
                    int length,
                    java.lang.String data)
Sets data in the internal HSM data buffer. The write to the internal buffer starts at the specified position and continues for the specified length. The internal position variable is set to the end of the data just written.
Parameters:
start - the starting position in the HSM data buffer.
length - the number of characters to set.
data - the data to set.

setData

public void setData(int start,
                    int length,
                    java.lang.StringBuffer data)
Sets data in the internal HSM data buffer. The write to the internal buffer starts at the specified position and continues for the specified length. The internal position variable is set to the end of the data just written.
Parameters:
start - the starting position in the HSM data buffer.
length - the number of characters to set.
data - the data to set.

setDataNext

public void setDataNext(char[] data)
Sets data in the internal HSM data buffer based on the last setData method call. The write to the internal buffer starts at the internal position variable and continues for the length of the data. The internal position variable is set to the end of the data just written.
Parameters:
data - the data to set.

setDataNext

public void setDataNext(java.lang.String data)
Sets data in the internal HSM data buffer based on the last setData method call. The write to the internal buffer starts at the internal position variable and continues for the length of the data. The internal position variable is set to the end of the data just written.
Parameters:
data - the data to set.

setDataNext

public void setDataNext(java.lang.StringBuffer data)
Sets data in the internal HSM data buffer based on the last setData method call. The write to the internal buffer starts at the internal position variable and continues for the length of the data. The internal position variable is set to the end of the data just written.
Parameters:
data - the data to set.

setDataNext

public void setDataNext(int length,
                        java.lang.String data)
Sets data in the internal HSM data buffer based on the last setData method call. The write to the internal buffer starts at the internal position variable and continues for the specified length. The internal position variable is set to the end of the data just written.
Parameters:
length - the number of characters to set.
data - the data to set.

setDataNext

public void setDataNext(int length,
                        char[] data)
Sets data in the internal HSM data buffer based on the last setData method call. The write to the internal buffer starts at the internal position variable and continues for the specified length. The internal position variable is set to the end of the data just written.
Parameters:
length - the number of characters to set.
data - the data to set.

setDataNext

public void setDataNext(int length,
                        java.lang.StringBuffer data)
Sets data in the internal HSM data buffer based on the last setData method call. The write to the internal buffer starts at the internal position variable and continues for the specified length. The internal position variable is set to the end of the data just written.
Parameters:
length - the number of characters to set.
data - the data to set.

getChars

public char[] getChars()
Gets all valid HSM data from the internal HSM data buffer. The internal position variable is set to the end of the data just read.
Returns:
all valid HSM data.

getChars

public char[] getChars(int start)
Gets data from the internal HSM data buffer. The data is read from the specified position to the end of the buffer. The internal position variable is set to the end of the data just read.
Parameters:
start - the starting position in the HSM data buffer.
Returns:
valid HSM data.

getChars

public char[] getChars(int start,
                       int length)
Gets data from the internal HSM data buffer. The specified number of characters are read starting from the specified position. The internal position variable is set to the end of the data just read.
Parameters:
start - the starting position in the HSM data buffer.
length - the number of characters to get.
Returns:
valid HSM data.

getCharsNext

public char[] getCharsNext()
Gets all remaining data from the internal HSM data buffer based on the last get method call. The data is read from the internal position variable to the end of the buffer. The internal position variable is set to the end of the data just read.
Returns:
valid HSM data.

getCharsNext

public char[] getCharsNext(int length)
Gets remaining data from the internal HSM data buffer based on the last get method call. The specified number of characters are read starting from the internal position variable. The internal position variable is set to the end of the data just read.
Parameters:
length - the number of characters to get.
Returns:
valid HSM data.

getString

public java.lang.String getString()
Gets all valid HSM data from the internal HSM data buffer. The internal position variable is set to the end of the data just read.
Returns:
all valid HSM data.

getString

public java.lang.String getString(int start)
Gets data from the internal HSM data buffer. The data is read from the specified position to the end of the buffer. The internal position variable is set to the end of the data just read.
Parameters:
start - the starting position in the HSM data buffer.
Returns:
valid HSM data.

getString

public java.lang.String getString(int start,
                                  int length)
Gets data from the internal HSM data buffer. The specified number of characters are read starting from the specified position. The internal position variable is set to the end of the data just read.
Parameters:
start - the starting position in the HSM data buffer.
length - the number of characters to get.
Returns:
valid HSM data.

getStringNext

public java.lang.String getStringNext()
Gets all remaining data from the internal HSM data buffer based on the last get method call. The data is read from the internal position variable to the end of the buffer. The internal position variable is set to the end of the data just read.
Returns:
valid HSM data.

getStringNext

public java.lang.String getStringNext(int length)
Gets remaining data from the internal HSM data buffer based on the last get method call. The specified number of characters are read starting from the internal position variable. The internal position variable is set to the end of the data just read.
Parameters:
length - the number of characters to get.
Returns:
valid HSM data.

getStringBuffer

public java.lang.StringBuffer getStringBuffer()
Gets all valid HSM data from the internal HSM data buffer. The internal position variable is set to the end of the data just read.
Returns:
all valid HSM data.

getStringBuffer

public java.lang.StringBuffer getStringBuffer(int start)
Gets data from the internal HSM data buffer. The data is read from the specified position to the end of the buffer. The internal position variable is set to the end of the data just read.
Parameters:
start - the starting position in the HSM data buffer.
Returns:
valid HSM data.

getStringBuffer

public java.lang.StringBuffer getStringBuffer(int start,
                                              int length)
Gets data from the internal HSM data buffer. The specified number of characters are read starting from the specified position. The internal position variable is set to the end of the data just read.
Parameters:
start - the starting position in the HSM data buffer.
length - the number of characters to get.
Returns:
valid HSM data.

getStringBufferNext

public java.lang.StringBuffer getStringBufferNext()
Gets all remaining data from the internal HSM data buffer based on the last get method call. The data is read from the internal position variable to the end of the buffer. The internal position variable is set to the end of the data just read.
Returns:
valid HSM data.

getStringBufferNext

public java.lang.StringBuffer getStringBufferNext(int length)
Gets remaining data from the internal HSM data buffer based on the last get method call. The specified number of characters are read starting from the internal position variable. The internal position variable is set to the end of the data just read.
Parameters:
length - the number of characters to get.
Returns:
valid HSM data.