org.apache.poi.hmef

## Class CompressedRTF

- java.lang.Object
- - org.apache.poi.util.LZWDecompresser
  - - org.apache.poi.hmef.CompressedRTF

-     public final class CompressedRTF
      extends LZWDecompresser

  Within a `HMEFMessage`, the content is often stored in as RTF, but LZW compressed. This class handles decompressing it for you.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `COMPRESSED_SIGNATURE_INT`
    `static java.lang.String` | `LZW_RTF_PRELOAD`
    `static int` | `UNCOMPRESSED_SIGNATURE_INT`

    - ### Fields inherited from class org.apache.poi.util.LZWDecompresser

      `DICT_MASK, DICT_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompressedRTF()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `adjustDictionaryOffset(int offset)` We use regular dictionary offsets, so no need to change anything
    `void` | `decompress(java.io.InputStream src, java.io.OutputStream res)` Decompresses the whole of the compressed RTF stream, outputting the resulting RTF bytes.
    `int` | `getCompressedSize()` Returns how big the compressed version was.
    `int` | `getDeCompressedSize()` Returns how big the decompressed version was.
    `protected int` | `populateDictionary(byte[] dict)` Populates the dictionary, and returns where in it to begin writing new codes.

    - ### Methods inherited from class org.apache.poi.util.LZWDecompresser

      `decompress`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### COMPRESSED_SIGNATURE_INT

          public static final int COMPRESSED_SIGNATURE_INT

    - #### UNCOMPRESSED_SIGNATURE_INT

          public static final int UNCOMPRESSED_SIGNATURE_INT

    - #### LZW_RTF_PRELOAD

          public static final java.lang.String LZW_RTF_PRELOAD

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CompressedRTF

          public CompressedRTF()

  - ### Method Detail

    - #### decompress

          public void decompress(java.io.InputStream src,
                                 java.io.OutputStream res)
                          throws java.io.IOException

      Decompresses the whole of the compressed RTF stream, outputting the resulting RTF bytes. Note - will decompress any padding at the end of the input, if present, use `getDeCompressedSize()` if you need to know how much of the result is real. (Padding may be up to 7 bytes).
      Overrides:
        `decompress` in class `LZWDecompresser`
      Throws:
        `java.io.IOException`

    - #### getCompressedSize

          public int getCompressedSize()

      Returns how big the compressed version was.

    - #### getDeCompressedSize

          public int getDeCompressedSize()

      Returns how big the decompressed version was.

    - #### adjustDictionaryOffset

          protected int adjustDictionaryOffset(int offset)

      We use regular dictionary offsets, so no need to change anything
      Specified by:
        `adjustDictionaryOffset` in class `LZWDecompresser`

    - #### populateDictionary

          protected int populateDictionary(byte[] dict)

      Description copied from class: `LZWDecompresser`
      Populates the dictionary, and returns where in it to begin writing new codes. Generally, if the dictionary is pre-populated, then new codes should be placed at the end of that block. Equally, if the dictionary is left with all zeros, then usually the new codes can go in at the start.
      Specified by:
        `populateDictionary` in class `LZWDecompresser`

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