org.apache.poi.hwpf.model

## Class OldTextPiece

- java.lang.Object
- - org.apache.poi.hwpf.model.PropertyNode<TextPiece>
  - - org.apache.poi.hwpf.model.TextPiece
    - - org.apache.poi.hwpf.model.OldTextPiece

- All Implemented Interfaces:
    java.lang.Comparable<TextPiece>, Duplicatable

      @Internal
      public class OldTextPiece
      extends TextPiece

  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.

- - ### Field Summary

    - ### Fields inherited from class org.apache.poi.hwpf.model.PropertyNode

      `_buf, EndComparator, StartComparator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OldTextPiece(int start, int end, byte[] text, PieceDescriptor pd)`
    `OldTextPiece(OldTextPiece other)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `adjustForDelete(int start, int length)` Deprecated.
    `int` | `bytesLength()` Returns the length, in bytes
    `OldTextPiece` | `copy()`
    `boolean` | `equals(java.lang.Object other)`
    `byte[]` | `getRawBytes()`
    `java.lang.StringBuilder` | `getStringBuilder()`
    `int` | `hashCode()`
    `boolean` | `isUnicode()`
    `java.lang.String` | `substring(int start, int end)` Deprecated.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.apache.poi.hwpf.model.TextPiece

      `characterLength, getCP, getPieceDescriptor, getStringBuffer`

    - ### 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, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### OldTextPiece

          public OldTextPiece(OldTextPiece other)

    - #### OldTextPiece

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

      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

          @NotImplemented
          public boolean isUnicode()

      Overrides:
        `isUnicode` in class `TextPiece`
      Returns:
        nothing, ever. Always throws an UnsupportedOperationException
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### getStringBuilder

          public java.lang.StringBuilder getStringBuilder()

      Overrides:
        `getStringBuilder` in class `TextPiece`

    - #### getRawBytes

          public byte[] getRawBytes()

      Overrides:
        `getRawBytes` in class `TextPiece`

    - #### substring

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

      Deprecated.
      Returns part of the string. Works only in characters, not in bytes!
      Overrides:
        `substring` in class `TextPiece`
      Parameters:
        `start` - Local start position, in characters
        `end` - Local end position, in characters
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### adjustForDelete

          @Deprecated
           @NotImplemented
          public void adjustForDelete(int start,
                                                                   int length)

      Deprecated.
      Not implemented for OldTextPiece. Always throws UnsupportedOperationException
      Overrides:
        `adjustForDelete` in class `TextPiece`
      Parameters:
        `start` - The start position for the delete, in characters
        `length` - The number of characters to delete

    - #### bytesLength

          public int bytesLength()

      Returns the length, in bytes
      Overrides:
        `bytesLength` in class `TextPiece`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `TextPiece`

    - #### equals

          public boolean equals(java.lang.Object other)

      Overrides:
        `equals` in class `TextPiece`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `TextPiece`

    - #### copy

          public OldTextPiece copy()

      Specified by:
        `copy` in interface `Duplicatable`
      Overrides:
        `copy` in class `TextPiece`
      Returns:
        a deep copy of the implementing class / instance

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