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

## com.lowagie.text.rtf.document
Class RtfDocument

    java.lang.Object
      com.lowagie.text.rtf.RtfElement
          com.lowagie.text.rtf.document.RtfDocument

All Implemented Interfaces:
  RtfBasicElement

    public class RtfDocument

extends RtfElement

The RtfDocument stores all document related data and also the main data stream. INTERNAL CLASS - NOT TO BE USED DIRECTLY

Version:
  $Id: RtfDocument.java 2996 2007-11-20 22:40:36Z hallm $
Author:
  Mark Hall (mhall@edu.uni-klu.ac.at), Todd Bush [Tab support], Thomas Bickel (tmb99@inode.at)

Field Summary
`private boolean` | `autogenerateTOCEntries` Whether to automatically generate TOC entries for Chapters and Sections.
`private RtfDataCache` | `data` Stores the actual document data
`private RtfDocumentHeader` | `documentHeader` The RtfDocumentHeader that handles all document header methods
`private RtfDocumentSettings` | `documentSettings` The RtfDocumentSettings for this RtfDocument.
`private static byte[]` | `FSC_BACKSLASH`
`private static byte[]` | `FSC_HEX_PREFIX`
`private static byte[]` | `FSC_LINE`
`private static byte[]` | `FSC_NEWPAGE`
`private static byte[]` | `FSC_PAGE_PAR`
`private static byte[]` | `FSC_PAR`
`private static byte[]` | `FSC_TAB`
`private static byte[]` | `FSC_UNI_PREFIX`
`private RtfBasicElement` | `lastElementWritten` The last RtfBasicElement that was added directly to the RtfDocument.
`private RtfMapper` | `mapper` The RtfMapper to use in this RtfDocument
`private ArrayList` | `previousRandomInts` Stores integers that have been generated as unique random numbers
`private static byte[]` | `RTF_DOCUMENT` Constant for the Rtf document start

Fields inherited from class com.lowagie.text.rtf.RtfElement
`document, inHeader, inTable`

Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
`CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR`

Constructor Summary
`RtfDocument()` The default constructor for a RtfDocument

Method Summary
`void` | `add(RtfBasicElement element)` Adds an element to the rtf document
`void` | `filterSpecialChar(OutputStream out, String str, boolean useHex, boolean softLineBreaks)` Writes the given string to the given `OutputStream` encoding the string characters.
`String` | `filterSpecialChar(String str, boolean useHex, boolean softLineBreaks)` Deprecated. As of iText 2.0.6 or earlier, replaced by `filterSpecialChar(OutputStream, String, boolean, boolean)`, scheduled for removal at or after 2.1.0
`boolean` | `getAutogenerateTOCEntries()` Get whether to autmatically generate table of contents entries
`RtfDocumentHeader` | `getDocumentHeader()` Gets the RtfDocumentHeader of this RtfDocument
`RtfDocumentSettings` | `getDocumentSettings()` Gets the RtfDocumentSettings that specify how the rtf document is generated.
`RtfBasicElement` | `getLastElementWritten()` Gets the last RtfBasicElement that was directly added to the RtfDocument.
`RtfMapper` | `getMapper()` Gets the RtfMapper object of this RtfDocument
`int` | `getRandomInt()` Generates a random integer that is unique with respect to the document.
`void` | `open()` Opens the RtfDocument and initialises the data cache.
`void` | `setAutogenerateTOCEntries(boolean autogenerate)` Whether to automagically generate table of contents entries when adding Chapters or Sections.
`private static boolean` | `subMatch(String str, int soff, byte[] m)` Returns `true` if `m.length` characters in `str`, starting at offset `soff` match the bytes in the given array `m`.
`byte[]` | `write()` Deprecated. As of iText 2.0.6 or earlier, replaced by `writeContent(OutputStream)`, scheduled for removal at or after 2.1.0
`void` | `writeContent(OutputStream out)` unused
`void` | `writeDocument(OutputStream out)` Writes the document

Methods inherited from class com.lowagie.text.rtf.RtfElement
`intToByteArray, isInTable, setInHeader, setInTable, setRtfDocument`

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

Field Detail

### data

    private RtfDataCache data

  Stores the actual document data

### mapper

    private RtfMapper mapper

  The RtfMapper to use in this RtfDocument

### documentHeader

    private RtfDocumentHeader documentHeader

  The RtfDocumentHeader that handles all document header methods

### previousRandomInts

    private ArrayList previousRandomInts

  Stores integers that have been generated as unique random numbers

### autogenerateTOCEntries

    private boolean autogenerateTOCEntries

  Whether to automatically generate TOC entries for Chapters and Sections. Defaults to false

### documentSettings

    private RtfDocumentSettings documentSettings

  The RtfDocumentSettings for this RtfDocument.

### lastElementWritten

    private RtfBasicElement lastElementWritten

  The last RtfBasicElement that was added directly to the RtfDocument.

### RTF_DOCUMENT

    private static final byte[] RTF_DOCUMENT

  Constant for the Rtf document start

### FSC_LINE

    private static final byte[] FSC_LINE

### FSC_PAR

    private static final byte[] FSC_PAR

### FSC_TAB

    private static final byte[] FSC_TAB

### FSC_PAGE_PAR

    private static final byte[] FSC_PAGE_PAR

### FSC_NEWPAGE

    private static final byte[] FSC_NEWPAGE

### FSC_BACKSLASH

    private static final byte[] FSC_BACKSLASH

### FSC_HEX_PREFIX

    private static final byte[] FSC_HEX_PREFIX

### FSC_UNI_PREFIX

    private static final byte[] FSC_UNI_PREFIX

Constructor Detail

### RtfDocument

    public RtfDocument()

  The default constructor for a RtfDocument

Method Detail

### write

    public byte[] write()

  Deprecated. As of iText 2.0.6 or earlier, replaced by `writeContent(OutputStream)`, scheduled for removal at or after 2.1.0

  unused

  Specified by:
    `write` in interface `RtfBasicElement`
  Specified by:
    `write` in class `RtfElement`
  Returns:
    An empty byte array

### writeContent

    public void writeContent(OutputStream out)
                      throws IOException

  unused

  Specified by:
    `writeContent` in interface `RtfBasicElement`
  Overrides:
    `writeContent` in class `RtfElement`
  Throws:
    `IOException`

### writeDocument

    public void writeDocument(OutputStream out)

  Writes the document

  Parameters:
    `out` - The `OutputStream` to write the RTF document to.

### open

    public void open()

  Opens the RtfDocument and initialises the data cache. If the data cache is set to CACHE_DISK, but the cache cannot be initialised then the memory cache is used.

### add

    public void add(RtfBasicElement element)

  Adds an element to the rtf document

  Parameters:
    `element` - The element to add

### getMapper

    public RtfMapper getMapper()

  Gets the RtfMapper object of this RtfDocument

  Returns:
    The RtfMapper

### getRandomInt

    public int getRandomInt()

  Generates a random integer that is unique with respect to the document.

  Returns:
    A random int

### getDocumentHeader

    public RtfDocumentHeader getDocumentHeader()

  Gets the RtfDocumentHeader of this RtfDocument

  Returns:
    The RtfDocumentHeader of this RtfDocument

### filterSpecialChar

    public String filterSpecialChar(String str,
                                    boolean useHex,
                                    boolean softLineBreaks)

  Deprecated. As of iText 2.0.6 or earlier, replaced by `filterSpecialChar(OutputStream, String, boolean, boolean)`, scheduled for removal at or after 2.1.0

  Replaces special characters with their unicode values

  Parameters:
    `str` - The original `String`
    `useHex` - indicated if the hexadecimal value has to be used
    `softLineBreaks` - whether to use soft line breaks instead of default hard ones.
  Returns:
    The converted String

### filterSpecialChar

    public void filterSpecialChar(OutputStream out,
                                  String str,
                                  boolean useHex,
                                  boolean softLineBreaks)
                           throws IOException

  Writes the given string to the given `OutputStream` encoding the string characters.

  Parameters:
    `out` - destination OutputStream
    `str` - string to write
    `useHex` - if `true` hex encoding characters is preferred to unicode encoding if possible
    `softLineBreaks` - if `true` return characters are written as soft line breaks
  Throws:
    `IOException`

### subMatch

    private static boolean subMatch(String str,
                                    int soff,
                                    byte[] m)

  Returns `true` if `m.length` characters in `str`, starting at offset `soff` match the bytes in the given array `m`.

  Parameters:
    `str` - the string to search for a match
    `soff` - the starting offset in str
    `m` - the array to match
  Returns:
    `true` if there is match

### setAutogenerateTOCEntries

    public void setAutogenerateTOCEntries(boolean autogenerate)

  Whether to automagically generate table of contents entries when adding Chapters or Sections.

  Parameters:
    `autogenerate` - Whether to automatically generate TOC entries

### getAutogenerateTOCEntries

    public boolean getAutogenerateTOCEntries()

  Get whether to autmatically generate table of contents entries

  Returns:
    Wheter to automatically generate TOC entries

### getDocumentSettings

    public RtfDocumentSettings getDocumentSettings()

  Gets the RtfDocumentSettings that specify how the rtf document is generated.

  Returns:
    The current RtfDocumentSettings.

### getLastElementWritten

    public RtfBasicElement getLastElementWritten()

  Gets the last RtfBasicElement that was directly added to the RtfDocument.

  Returns:
    The last RtfBasicElement that was directly added to the RtfDocument.

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