| Method from org.apache.cocoon.poi.hssf.record.UnicodeString Detail: |
public boolean equals(Object o) {
if ((o == null) || (o.getClass() != this.getClass()))
{
return false;
}
UnicodeString other = ( UnicodeString ) o;
return ((field_1_charCount == other.field_1_charCount)
&& (field_2_optionflags == other.field_2_optionflags)
&& field_3_string.equals(other.field_3_string));
}
|
protected void fillFields(byte[] data,
short size) {
field_1_charCount = LittleEndian.getShort(data, 0);
field_2_optionflags = data[ 2 ];
if ((field_2_optionflags & 1) == 0)
{
field_3_string = new String(data, 3, getCharCount());
}
else
{
char[] array = new char[ getCharCount() ];
for (int j = 0; j < array.length; j++)
{
array[ j ] = ( char ) LittleEndian.getShort(data,
3 + (j * 2));
}
field_3_string = new String(array);
}
}
|
protected void fillFields(byte[] data,
short size,
int offset) {
}
called by the constructor, should set class level fields. Should throw
runtime exception for bad/icomplete data. |
public short getCharCount() {
return field_1_charCount;
}
get the number of characters in the string |
public String getDebugInfo() {
StringBuffer buffer = new StringBuffer();
buffer.append("[UNICODESTRING]\n");
buffer.append(" .charcount = ")
.append(Integer.toHexString(getCharCount())).append("\n");
buffer.append(" .optionflags = ")
.append(Integer.toHexString(getOptionFlags())).append("\n");
buffer.append(" .string = ").append(getString())
.append("\n");
buffer.append("[/UNICODESTRING]\n");
return buffer.toString();
}
return a character representation of the fields of this record |
public byte getOptionFlags() {
return field_2_optionflags;
}
get the option flags which among other things return if this is a 16-bit or
8 bit string |
public short getSid() {
return this.sid;
}
|
public String getString() {
return field_3_string;
}
get the actual string this contains as a java String object |
public int hashCode() {
// = null;
return field_1_charCount;
}
|
public byte[] serialize() {
int charsize = 1;
if (getOptionFlags() == 1)
{
charsize = 2;
}
byte[] retval = new byte[ 3 + (getString().length() * charsize) ];
LittleEndian.putShort(retval, 0, getCharCount());
retval[ 2 ] = getOptionFlags();
// System.out.println("Unicode: We've got "+retval[2]+" for our option flag");
if (getOptionFlags() == 0)
{
StringUtil.putCompressedUnicode(getString(), retval, 0x3);
}
else
{
StringUtil.putUncompressedUnicode(getString(), retval, 0x3);
}
return retval;
}
|
public void setCharCount() {
field_1_charCount = ( short ) field_3_string.length();
}
sets the number of characters to whaterver number of characters is in the string
currently. effectively setCharCount(getString.length()). |
public void setCharCount(short cc) {
field_1_charCount = cc;
}
set the number of characters in the string |
public void setOptionFlags(byte of) {
field_2_optionflags = of;
}
set the option flags which among other things return if this is a 16-bit or
8 bit string |
public void setString(String string) {
field_3_string = string;
if (getCharCount() < field_3_string.length())
{
setCharCount();
}
}
set the actual string this contains |
public String toString() {
return getString();
}
unlike the real records we return the same as "getString()" rather than debug info |
protected void validateSid(short id) {
// included only for interface compliance
}
|