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.hwpf.model
Class TextPiece

    java.lang.Object
      org.apache.poi.hwpf.model.PropertyNode
          org.apache.poi.hwpf.model.TextPiece

All Implemented Interfaces:
  java.lang.Cloneable, java.lang.Comparable

    public final class TextPiece

extends PropertyNode
implements java.lang.Comparable

Lightweight representation of a text piece. Works in the character domain, not the byte domain, so you need to have turned byte references into character references before getting here.

Author:
  Ryan Ackley

Field Summary

Fields inherited from class org.apache.poi.hwpf.model.PropertyNode
`_buf`

Constructor Summary
`TextPiece(int start, int end, byte[] text, PieceDescriptor pd, int cpStart)`

Method Summary
`void` | `adjustForDelete(int start, int length)` Adjusts the internal string for deletinging some characters within this.
`int` | `bytesLength()` Returns the length, in bytes
`int` | `characterLength()` Returns the length, in characters
`boolean` | `equals(java.lang.Object o)`
`int` | `getCP()` Returns the character position we start at.
`PieceDescriptor` | `getPieceDescriptor()`
`byte[]` | `getRawBytes()`
`java.lang.StringBuffer` | `getStringBuffer()`
`boolean` | `isUnicode()`
`java.lang.String` | `substring(int start, int end)` Returns part of the string.

Methods inherited from class org.apache.poi.hwpf.model.PropertyNode
`clone, compareTo, getEnd, getStart, limitsAreEqual, setEnd, setStart`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.lang.Comparable
`compareTo`

Constructor Detail

### TextPiece

    public TextPiece(int start,
                     int end,
                     byte[] text,
                     PieceDescriptor pd,
                     int cpStart)

Parameters:
  `start` - Beginning offset in main document stream, in characters.
  `end` - Ending offset in main document stream, in characters.
  `text` - The raw bytes of our text

Method Detail

### isUnicode

    public boolean isUnicode()

  Returns:
    If this text piece is unicode

### getPieceDescriptor

    public PieceDescriptor getPieceDescriptor()

### getStringBuffer

    public java.lang.StringBuffer getStringBuffer()

### getRawBytes

    public byte[] getRawBytes()

### substring

    public java.lang.String substring(int start,
                                      int end)

  Returns part of the string. Works only in characters, not in bytes!

  Parameters:
    `start` - Local start position, in characters
    `end` - Local end position, in characters

### adjustForDelete

    public void adjustForDelete(int start,
                                int length)

  Adjusts the internal string for deletinging some characters within this.

  Overrides:
    `adjustForDelete` in class `PropertyNode`
  Parameters:
    `start` - The start position for the delete, in characters
    `length` - The number of characters to delete

### characterLength

    public int characterLength()

  Returns the length, in characters

### bytesLength

    public int bytesLength()

  Returns the length, in bytes

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `PropertyNode`

### getCP

    public int getCP()

  Returns the character position we start at.

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 2010 The Apache Software Foundation or its licensors, as applicable.