Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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)

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

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
`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
`java.lang.String` | `getDebugInfo()` return a character representation of the fields of this record
`byte` | `getOptionFlags()` get the option flags which among other things return if this is a 16-bit or 8 bit string
`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
`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
`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
`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 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

Parameters:
  `id` - - ignored
  `size` - - size of the data
  `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()

### 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.

  Parameters:
    `o` - The object to compare.
  Returns:
    true if the object is actually equal.

### 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

  Returns:
    number of characters

### setCharCount

    public void setCharCount(short cc)

  set the number of characters in the string

  Parameters:
    `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 Also:
    `setString(String)`, `getString()`

### 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

### toString

    public java.lang.String toString()

  unlike the real records we return the same as "getString()" rather than debug info

  Overrides:
    `toString` in class `Record`
  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(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.

  Specified by:
    `fillFields` in class `Record`
  Parameters:
    `data` - raw data
    `size` - size of data
    `offset` - of the records 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()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 Apache Software Foundation.