org.apache.poi.hssf.record
Class UnicodeString

java.lang.Object
  |
  +--org.apache.poi.hssf.record.Record
        |
        +--org.apache.poi.hssf.record.UnicodeString
All Implemented Interfaces:
java.lang.Comparable

public class UnicodeString
extends Record
implements java.lang.Comparable

Title: Unicode String

* Description: Unicode String record. We implement these as a record, although * they are really just standard fields that are in several records. * It is considered more desirable then repeating it in all of them.

* REFERENCE: PG 264 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

* @author Andrew C. Oliver * @author Marc Johnson (mjohnson at apache dot org) * @author Glen Stampoultzis (glens at apache.org) * @version 2.0-pre


Field Summary
static short sid
           
 
Constructor Summary
UnicodeString()
           
UnicodeString(short id, short size, byte[] data)
          construct a unicode string record and fill its fields, ID is ignored * @param id - ignored * @param size - size of the data * @param data - the bytes of the string/fields
UnicodeString(short id, short size, byte[] data, java.lang.String prefix)
          construct a unicode string from a string fragment + data
 
Method Summary
 int compareTo(java.lang.Object obj)
           
 boolean equals(java.lang.Object o)
          Our handling of equals is inconsistent with compareTo.
protected  void fillFields(byte[] data, short size)
          called by the constructor, should set class level fields.
protected  void fillFields(byte[] data, short size, int offset)
          called by the constructor, should set class level fields.
 short getCharCount()
          get the number of characters in the string * * @return number of characters *
 java.lang.String getDebugInfo()
          return a character representation of the fields of this record * * * @return String of output for biffviewer etc
 byte getOptionFlags()
          get the option flags which among other things return if this is a 16-bit or * 8 bit string * * @return optionflags bitmask *
 int getRecordSize()
          gives the current serialized size of the record.
 short getSid()
          return the non static version of the id for this record.
 java.lang.String getString()
          get the actual string this contains as a java String object * * * @return String *
 int hashCode()
           
 boolean isExtendedText()
           
 boolean isRichText()
           
 int serialize(int offset, byte[] data)
          called by the class that is responsible for writing this sucker.
 void setCharCount()
          sets the number of characters to whaterver number of characters is in the string * currently.
 void setCharCount(short cc)
          set the number of characters in the string * @param cc - number of characters
 void setOptionFlags(byte of)
          set the option flags which among other things return if this is a 16-bit or * 8 bit string * * @param of optionflags bitmask *
 void setString(java.lang.String string)
          set the actual string this contains * @param string the text
 java.lang.String toString()
          unlike the real records we return the same as "getString()" rather than debug info * @see #getDebugInfo() * @return String value of the record
protected  void validateSid(short id)
          NO OP
 
Methods inherited from class org.apache.poi.hssf.record.Record
clone, isInValueSection, isValue, processContinueRecord, serialize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sid

public static final short sid
See Also:
Constant Field Values
Constructor Detail

UnicodeString

public UnicodeString()

UnicodeString

public UnicodeString(short id,
                     short size,
                     byte[] data)
construct a unicode string record and fill its fields, ID is ignored * @param id - ignored * @param size - size of the data * @param data - the bytes of the string/fields


UnicodeString

public UnicodeString(short id,
                     short size,
                     byte[] data,
                     java.lang.String prefix)
construct a unicode string from a string fragment + data

Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Our handling of equals is inconsistent with compareTo. The trouble is because we don't truely understand * rich text fields yet it's difficult to make a sound comparison. * * @param o The object to compare. * @return true if the object is actually equal.

Overrides:
equals in class java.lang.Object

validateSid

protected void validateSid(short id)
NO OP

Specified by:
validateSid in class Record
Parameters:
id - alleged id for this record

fillFields

protected void fillFields(byte[] data,
                          short size)
Description copied from class: Record
called by the constructor, should set class level fields. Should throw runtime exception for bad/icomplete data.

Overrides:
fillFields in class Record
Parameters:
data - raw data

getCharCount

public short getCharCount()
get the number of characters in the string * * @return number of characters *


setCharCount

public void setCharCount(short cc)
set the number of characters in the string * @param cc - number of characters


setCharCount

public void setCharCount()
sets the number of characters to whaterver number of characters is in the string * currently. effectively setCharCount(getString.length()). * @see #setString(String) * @see #getString()


getOptionFlags

public byte getOptionFlags()
get the option flags which among other things return if this is a 16-bit or * 8 bit string * * @return optionflags bitmask *


setOptionFlags

public void setOptionFlags(byte of)
set the option flags which among other things return if this is a 16-bit or * 8 bit string * * @param of optionflags bitmask *


getString

public java.lang.String getString()
get the actual string this contains as a java String object * * * @return String *


setString

public void setString(java.lang.String string)
set the actual string this contains * @param string the text


toString

public java.lang.String toString()
unlike the real records we return the same as "getString()" rather than debug info * @see #getDebugInfo() * @return String value of the record

Overrides:
toString in class Record

getDebugInfo

public java.lang.String getDebugInfo()
return a character representation of the fields of this record * * * @return String of output for biffviewer etc. *


serialize

public int serialize(int offset,
                     byte[] data)
Description copied from class: Record
called by the class that is responsible for writing this sucker. Subclasses should implement this so that their data is passed back in a byte array.

Specified by:
serialize in class Record
Parameters:
offset - to begin writing at
data - byte array containing instance data
Returns:
number of bytes written

getRecordSize

public int getRecordSize()
Description copied from class: Record
gives the current serialized size of the record. Should include the sid and reclength (4 bytes).

Overrides:
getRecordSize in class Record

getSid

public short getSid()
Description copied from class: Record
return the non static version of the id for this record.

Specified by:
getSid in class Record

fillFields

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. * * @param data raw data * @param size size of data * @param offset of the records data (provided a big array of the file)

Specified by:
fillFields in class Record
Parameters:
data - raw data
size - size of data
offset - of the record's data (provided a big array of the file)

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable

isRichText

public boolean isRichText()

isExtendedText

public boolean isExtendedText()

jakarta-poi 1.10.0-dev

Copyright © 2003 Apache jakarta-poi project. All Rights Reserved.