IBM Branch Transformation Toolkit Javadoc

com.ibm.dse.base
Class SelfLength

java.lang.Object
  extended bycom.ibm.dse.base.FormatElement
      extended bycom.ibm.dse.base.FormatDecorator
          extended bycom.ibm.dse.base.SelfLength
All Implemented Interfaces:
Cacheable, Externalizable, java.io.Externalizable, java.io.Serializable

public class SelfLength
extends FormatDecorator

This decorator prepends a String with the byte-representation of the size of the String.

See Also:
Serialized Form

Field Summary
 int byteOrdering
           
 boolean lengthIncluded
           
 boolean lengthRepresentation
           
 int size
           
 
Fields inherited from class com.ibm.dse.base.FormatDecorator
decorated
 
Fields inherited from class com.ibm.dse.base.FormatElement
dataElementName, externalizer, name
 
Constructor Summary
SelfLength()
          This is the default constructor used to create a SelfLength object.
SelfLength(java.lang.String aName)
          This is the constructor used by the Externalizer to create a SelfLength object.
 
Method Summary
 java.lang.String addDecoration(java.lang.String aString)
          Prepends the length of the formatted String as an unsigned integer to the String.
 java.lang.String[] extract(java.lang.String aString)
          Extracts (strips) the substring corresponding to the format element from the input String and returns it and the remaining String as the elements of an array.
 int getByteOrdering()
          Returns the value of byteOrdering.
 boolean getLengthIncluded()
          Returns true if the length of the decorator is included in the length of the String.
 boolean getLengthRepresentation()
          Gets the value of the lengthRepresentation parameter.
 int getSize()
          Returns the size of the String.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a SelfLength object with the aTag attributes.
 java.lang.String removeDecoration(java.lang.String aString)
          Removes the size chars from the input String.
 void setByteOrdering(int anInt)
          Sets the value of byteOrdering.
 void setLengthIncluded(boolean aBoolean)
          Sets the value of the lengthIncluded attribute.
 void setLengthRepresentation(boolean aBoolean)
          Sets the value of the lengthRepresentation attribute.
 void setSize(int anInt)
          Sets the size of the decorating string.
 Vector toStrings()
          Returns a visual representation of this decorator.
 
Methods inherited from class com.ibm.dse.base.FormatDecorator
format, format, getDataElementName, getDecorated, getName, isConstant, isItConstant, reinitialize, rootDecorated, rootDecorator, setDecorated, toString, unformat, unformat
 
Methods inherited from class com.ibm.dse.base.FormatElement
exceptionInfo, externalizer, format, getExternalizer, getTagName, isCacheable, readExternal, readExternal, readObject, removeExternal, setDataElementName, setExternalizer, setName, toTags, unformat, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

size

public int size

byteOrdering

public int byteOrdering

lengthIncluded

public boolean lengthIncluded

lengthRepresentation

public boolean lengthRepresentation
Constructor Detail

SelfLength

public SelfLength()
This is the default constructor used to create a SelfLength object.


SelfLength

public SelfLength(java.lang.String aName)
           throws java.io.IOException
This is the constructor used by the Externalizer to create a SelfLength object.

Method Detail

addDecoration

public java.lang.String addDecoration(java.lang.String aString)
                               throws DSEInvalidArgumentException
Prepends the length of the formatted String as an unsigned integer to the String. The length is determined by the size attribute.

Specified by:
addDecoration in class FormatDecorator
Parameters:
aString - String
Returns:
String
Throws:
DSEInvalidArgumentException

extract

public java.lang.String[] extract(java.lang.String aString)
                           throws DSEInvalidArgumentException
Extracts (strips) the substring corresponding to the format element from the input String and returns it and the remaining String as the elements of an array.

Overrides:
extract in class FormatDecorator
Parameters:
aString - String
Returns:
String[]
Throws:
DSEInvalidArgumentException

getByteOrdering

public int getByteOrdering()
Returns the value of byteOrdering.

Returns:
int

getLengthIncluded

public boolean getLengthIncluded()
Returns true if the length of the decorator is included in the length of the String.

Returns:
boolean

getLengthRepresentation

public boolean getLengthRepresentation()
Gets the value of the lengthRepresentation parameter. If this parameter is true, the length appears as a String in the decorated String, Otherwise the length appears as bytes.

Returns:
boolean

getSize

public int getSize()
Returns the size of the String.

Returns:
int

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
Initializes a SelfLength object with the aTag attributes.

Specified by:
initializeFrom in interface Externalizable
Specified by:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
Object

removeDecoration

public java.lang.String removeDecoration(java.lang.String aString)
                                  throws DSEInvalidArgumentException
Removes the size chars from the input String. This method changes the size attribute of the decorated String to the size indicated by the decorator.

Specified by:
removeDecoration in class FormatDecorator
Parameters:
aString - String
Returns:
String
Throws:
DSEInvalidArgumentException

setByteOrdering

public void setByteOrdering(int anInt)
Sets the value of byteOrdering. The values of the parameter are:

Parameters:
anInt - int

setLengthIncluded

public void setLengthIncluded(boolean aBoolean)
Sets the value of the lengthIncluded attribute. If set to true, the total length of the decorated String includes a String or bytes giving the length of the String.

Parameters:
aBoolean - boolean

setLengthRepresentation

public void setLengthRepresentation(boolean aBoolean)
Sets the value of the lengthRepresentation attribute. If set to true, the total length of the decorated String includes a String giving the length of the String. If set to false, the total length of the decorated String includes bytes giving the length of the String.

Parameters:
aBoolean - boolean

setSize

public void setSize(int anInt)
Sets the size of the decorating string.

Overrides:
setSize in class FormatElement
Parameters:
anInt - int

toStrings

public Vector toStrings()
Returns a visual representation of this decorator.

Specified by:
toStrings in interface Externalizable
Specified by:
toStrings in class FormatDecorator
Returns:
java.lang.String

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005