net.kano.joscar
Class StringBlock

java.lang.Object
  extended bynet.kano.joscar.StringBlock

public final class StringBlock
extends java.lang.Object

A very simple but very common data structure containing a string and the total size of the structure that held that string (including the string itself).


Constructor Summary
StringBlock(java.lang.String string, int totalSize)
          Creates a new StringBlock object with the given properties.
 
Method Summary
 java.lang.String getString()
          Returns the string read from binary data to create this structure.
 int getTotalSize()
          Returns the total size of this object, as read from a block of binary data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringBlock

public StringBlock(java.lang.String string,
                   int totalSize)
Creates a new StringBlock object with the given properties.

Parameters:
string - the string read
totalSize - the size of this structure, as read from a block of binary data
Method Detail

getString

public final java.lang.String getString()
Returns the string read from binary data to create this structure.

Returns:
this object's string value

getTotalSize

public final int getTotalSize()
Returns the total size of this object, as read from a block of binary data. This is most commonly equivalent to getString().length() + 1, but that is not always the case.

Returns:
the total size of this structure: how many bytes were read to read this string