com.lowagie.text.pdf.codec

## Class JBIG2SegmentReader

- java.lang.Object
- - com.lowagie.text.pdf.codec.JBIG2SegmentReader

-     public class JBIG2SegmentReader
      extends java.lang.Object

  Class to read a JBIG2 file at a basic level: understand all the segments, understand what segments belong to which pages, how many pages there are, what the width and height of each page is, and global segments if there are any. Or: the minimum required to be able to take a normal sequential or random-access organized file, and be able to embed JBIG2 pages as images in a PDF. TODO: the indeterminate-segment-size value of dataLength, else?
  Since:
    2.1.5

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JBIG2SegmentReader.JBIG2Page` Inner class that holds information about a JBIG2 page.
    `static class` | `JBIG2SegmentReader.JBIG2Segment` Inner class that holds information about a JBIG2 segment.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `END_OF_FILE`
    `static int` | `END_OF_PAGE`
    `static int` | `END_OF_STRIPE`
    `static int` | `EXTENSION`
    `private java.util.SortedSet` | `globals`
    `static int` | `IMMEDIATE_GENERIC_REFINEMENT_REGION`
    `static int` | `IMMEDIATE_GENERIC_REGION`
    `static int` | `IMMEDIATE_HALFTONE_REGION`
    `static int` | `IMMEDIATE_LOSSLESS_GENERIC_REFINEMENT_REGION`
    `static int` | `IMMEDIATE_LOSSLESS_GENERIC_REGION`
    `static int` | `IMMEDIATE_LOSSLESS_HALFTONE_REGION`
    `static int` | `IMMEDIATE_LOSSLESS_TEXT_REGION`
    `static int` | `IMMEDIATE_TEXT_REGION`
    `static int` | `INTERMEDIATE_GENERIC_REFINEMENT_REGION`
    `static int` | `INTERMEDIATE_GENERIC_REGION`
    `static int` | `INTERMEDIATE_HALFTONE_REGION`
    `static int` | `INTERMEDIATE_TEXT_REGION`
    `private int` | `number_of_pages`
    `private boolean` | `number_of_pages_known`
    `static int` | `PAGE_INFORMATION`
    `private java.util.SortedMap` | `pages`
    `static int` | `PATTERN_DICTIONARY`
    `static int` | `PROFILES`
    `private RandomAccessFileOrArray` | `ra`
    `private boolean` | `read`
    `private java.util.SortedMap` | `segments`
    `private boolean` | `sequential`
    `static int` | `SYMBOL_DICTIONARY`
    `static int` | `TABLES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JBIG2SegmentReader(RandomAccessFileOrArray ra)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `copyByteArray(byte[] b)`
    `byte[]` | `getGlobal(boolean for_embedding)`
    `JBIG2SegmentReader.JBIG2Page` | `getPage(int page)`
    `int` | `getPageHeight(int i)`
    `int` | `getPageWidth(int i)`
    `int` | `numberOfPages()`
    `void` | `read()`
    `(package private) void` | `readFileHeader()`
    `(package private) JBIG2SegmentReader.JBIG2Segment` | `readHeader()`
    `(package private) void` | `readSegment(JBIG2SegmentReader.JBIG2Segment s)`
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### SYMBOL_DICTIONARY

          public static final int SYMBOL_DICTIONARY

      See Also:
        Constant Field Values

    - #### INTERMEDIATE_TEXT_REGION

          public static final int INTERMEDIATE_TEXT_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_TEXT_REGION

          public static final int IMMEDIATE_TEXT_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_LOSSLESS_TEXT_REGION

          public static final int IMMEDIATE_LOSSLESS_TEXT_REGION

      See Also:
        Constant Field Values

    - #### PATTERN_DICTIONARY

          public static final int PATTERN_DICTIONARY

      See Also:
        Constant Field Values

    - #### INTERMEDIATE_HALFTONE_REGION

          public static final int INTERMEDIATE_HALFTONE_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_HALFTONE_REGION

          public static final int IMMEDIATE_HALFTONE_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_LOSSLESS_HALFTONE_REGION

          public static final int IMMEDIATE_LOSSLESS_HALFTONE_REGION

      See Also:
        Constant Field Values

    - #### INTERMEDIATE_GENERIC_REGION

          public static final int INTERMEDIATE_GENERIC_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_GENERIC_REGION

          public static final int IMMEDIATE_GENERIC_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_LOSSLESS_GENERIC_REGION

          public static final int IMMEDIATE_LOSSLESS_GENERIC_REGION

      See Also:
        Constant Field Values

    - #### INTERMEDIATE_GENERIC_REFINEMENT_REGION

          public static final int INTERMEDIATE_GENERIC_REFINEMENT_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_GENERIC_REFINEMENT_REGION

          public static final int IMMEDIATE_GENERIC_REFINEMENT_REGION

      See Also:
        Constant Field Values

    - #### IMMEDIATE_LOSSLESS_GENERIC_REFINEMENT_REGION

          public static final int IMMEDIATE_LOSSLESS_GENERIC_REFINEMENT_REGION

      See Also:
        Constant Field Values

    - #### PAGE_INFORMATION

          public static final int PAGE_INFORMATION

      See Also:
        Constant Field Values

    - #### END_OF_PAGE

          public static final int END_OF_PAGE

      See Also:
        Constant Field Values

    - #### END_OF_STRIPE

          public static final int END_OF_STRIPE

      See Also:
        Constant Field Values

    - #### END_OF_FILE

          public static final int END_OF_FILE

      See Also:
        Constant Field Values

    - #### PROFILES

          public static final int PROFILES

      See Also:
        Constant Field Values

    - #### TABLES

          public static final int TABLES

      See Also:
        Constant Field Values

    - #### EXTENSION

          public static final int EXTENSION

      See Also:
        Constant Field Values

    - #### segments

          private final java.util.SortedMap segments

    - #### pages

          private final java.util.SortedMap pages

    - #### globals

          private final java.util.SortedSet globals

    - #### ra

          private RandomAccessFileOrArray ra

    - #### sequential

          private boolean sequential

    - #### number_of_pages_known

          private boolean number_of_pages_known

    - #### number_of_pages

          private int number_of_pages

    - #### read

          private boolean read

  - ### Constructor Detail

    - #### JBIG2SegmentReader

          public JBIG2SegmentReader(RandomAccessFileOrArray ra)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### copyByteArray

          public static byte[] copyByteArray(byte[] b)

    - #### read

          public void read()
                    throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readSegment

          void readSegment(JBIG2SegmentReader.JBIG2Segment s)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readHeader

          JBIG2SegmentReader.JBIG2Segment readHeader()
                                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readFileHeader

          void readFileHeader()
                        throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### numberOfPages

          public int numberOfPages()

    - #### getPageHeight

          public int getPageHeight(int i)

    - #### getPageWidth

          public int getPageWidth(int i)

    - #### getPage

          public JBIG2SegmentReader.JBIG2Page getPage(int page)

    - #### getGlobal

          public byte[] getGlobal(boolean for_embedding)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`