org.apache.poi.hssf.record
Class UnicodeString

java.lang.Object
  extended by org.apache.poi.hssf.record.UnicodeString
All Implemented Interfaces:
java.lang.Comparable

public class UnicodeString
extends java.lang.Object
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)

Version:
2.0-pre
Author:
Andrew C. Oliver, Marc Johnson (mjohnson at apache dot org), Glen Stampoultzis (glens at apache.org)

Nested Class Summary
static class UnicodeString.FormatRun
           
static class UnicodeString.UnicodeRecordStats
          Returns the size of this record, given the ammount of record space remaining, it will also include the size of writing a continue record.
 
Field Summary
static short sid
           
 
Constructor Summary
UnicodeString(RecordInputStream in)
          construct a unicode string record and fill its fields, ID is ignored
UnicodeString(java.lang.String str)
           
 
Method Summary
 void addFormatRun(UnicodeString.FormatRun r)
          Adds a font run to the formatted string.
 void clearFormatting()
           
 java.lang.Object clone()
           
 int compareTo(java.lang.Object obj)
           
 boolean equals(java.lang.Object o)
          Our handling of equals is inconsistent with compareTo.
protected  void fillFields(RecordInputStream in)
           
 java.util.Iterator formatIterator()
           
 short getCharCount()
          get the number of characters in the string
 java.lang.String getDebugInfo()
          return a character representation of the fields of this record
 byte[] getExtendedRst()
           
 UnicodeString.FormatRun getFormatRun(int index)
           
 int getFormatRunCount()
           
 byte getOptionFlags()
          get the option flags which among other things return if this is a 16-bit or 8 bit string
 void getRecordSize(UnicodeString.UnicodeRecordStats stats)
           
 short getSid()
           
 java.lang.String getString()
          get the actual string this contains as a java String object
 int hashCode()
           
 boolean isExtendedText()
           
 boolean isRichText()
           
 void removeFormatRun(UnicodeString.FormatRun r)
           
 int serialize(UnicodeString.UnicodeRecordStats stats, int offset, byte[] data)
           
 void setCharCount(short cc)
          set the number of characters in the string
 void setCompressedUnicode()
           
 void setExtendedRst(byte[] ext_rst)
           
 void setOptionFlags(byte of)
          set the option flags which among other things return if this is a 16-bit or 8 bit string
 void setString(java.lang.String string)
          set the actual string this contains
 void setUncompressedUnicode()
           
 java.lang.String toString()
          unlike the real records we return the same as "getString()" rather than debug info
protected  void validateSid(short id)
          NO OP
 
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(java.lang.String str)

UnicodeString

public UnicodeString(RecordInputStream in)
construct a unicode string record and fill its fields, ID is ignored

Parameters:
in - the RecordInputstream to read the record from
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.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to compare.
Returns:
true if the object is actually equal.

validateSid

protected void validateSid(short id)
NO OP


fillFields

protected void fillFields(RecordInputStream in)
Parameters:
in - the RecordInputstream to read the record from

getCharCount

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

Returns:
number of characters

setCharCount

public void setCharCount(short cc)
set the number of characters in the string

Parameters:
cc - - number of characters

getOptionFlags

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

Returns:
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

Parameters:
of - optionflags bitmask

getString

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

Returns:
String

setString

public void setString(java.lang.String string)
set the actual string this contains

Parameters:
string - the text

getFormatRunCount

public int getFormatRunCount()

getFormatRun

public UnicodeString.FormatRun getFormatRun(int index)

addFormatRun

public void addFormatRun(UnicodeString.FormatRun r)
Adds a font run to the formatted string. If a font run exists at the current charcter location, then it is replaced with the font run to be added.


formatIterator

public java.util.Iterator formatIterator()

removeFormatRun

public void removeFormatRun(UnicodeString.FormatRun r)

clearFormatting

public void clearFormatting()

getExtendedRst

public byte[] getExtendedRst()

setExtendedRst

public void setExtendedRst(byte[] ext_rst)

toString

public java.lang.String toString()
unlike the real records we return the same as "getString()" rather than debug info

Overrides:
toString in class java.lang.Object
Returns:
String value of the record
See Also:
getDebugInfo()

getDebugInfo

public java.lang.String getDebugInfo()
return a character representation of the fields of this record

Returns:
String of output for biffviewer etc.

serialize

public int serialize(UnicodeString.UnicodeRecordStats stats,
                     int offset,
                     byte[] data)

setCompressedUnicode

public void setCompressedUnicode()

setUncompressedUnicode

public void setUncompressedUnicode()

getRecordSize

public void getRecordSize(UnicodeString.UnicodeRecordStats stats)

getSid

public short getSid()

compareTo

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

isRichText

public boolean isRichText()

isExtendedText

public boolean isExtendedText()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.