Top Description Fields Constructors Methods
org.apache.pdfbox.jbig2.segments

public Class SymbolDictionary

extends Object
implements Dictionary
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.jbig2.Dictionary, org.apache.pdfbox.jbig2.SegmentData
Imports
java.awt.Rectangle, java.io.IOException, java.util.ArrayList, org.apache.pdfbox.jbig2.Bitmap, .Dictionary, .Region, .SegmentHeader, org.apache.pdfbox.jbig2.decoder.arithmetic.ArithmeticDecoder, .ArithmeticIntegerDecoder, .CX, org.apache.pdfbox.jbig2.decoder.huffman.EncodedTable, .HuffmanTable, .StandardTables, org.apache.pdfbox.jbig2.err.IntegerMaxValueException, .InvalidHeaderValueException, org.apache.pdfbox.jbig2.image.Bitmaps, org.apache.pdfbox.jbig2.io.SubInputStream

This class represents the data of segment type "Symbol dictionary". Parsing is described in 7.4.2.1.1 - 7.4.1.1.5 and decoding procedure is described in 6.5.

Field Summary

Modifier and TypeField and Description
private HuffmanTable
private int
private int
amountOfExportSymbolss

Number of exported symbols, 7.4.2.1.4

private int
private int
amountOfNewSymbols

Number of new symbols, 7.4.2.1.5

private ArithmeticDecoder
private HuffmanTable
private CX
private CX
private CX
private CX
private CX
private CX
protected CX
private CX
private CX
private HuffmanTable
dhTable

User-supplied tables *

private HuffmanTable
private ArrayList<Bitmap>
exportSymbols

Return value of that segment

private GenericRefinementRegion
private GenericRegion
private ArithmeticIntegerDecoder
private ArrayList<Bitmap>
private boolean
private boolean
private boolean
private Bitmap[]
private ArrayList<Bitmap>
private int
private short[]
sdATX

Symbol dictionary AT flags, 7.4.2.1.2

private short[]
private short
private short
private short
private short
private short[]
sdrATX

Symbol dictionary refinement AT flags, 7.4.2.1.3

private short[]
private short
sdrTemplate

Symbol dictionary flags, 7.4.2.1.1

private byte
private SegmentHeader
segmentHeader

Further parameters

private SubInputStream
private TextRegion
private boolean

Constructor Summary

AccessConstructor and Description
public
public
SymbolDictionary(final SubInputStream subInputStream, final SegmentHeader segmentHeader)

Method Summary

Modifier and TypeMethod and Description
private final void
addSymbol(final Region region)

private void
private final void
decodeAggregate(final int symbolWidth, final int heightClassHeight)

private final long
private final void
decodeDirectlyThroughGenericRegion(final int symWidth, final int hcHeight)

private final void
decodeHeightClassBitmap(final Bitmap heightClassCollectiveBitmap, final int heightClassFirstSymbol, final int heightClassHeight, final int[] newSymbolsWidths)

private final Bitmap
decodeHeightClassCollectiveBitmap(final long bmSize, final int heightClassHeight, final int totalWidth)

private final long
private final long

Returns:

long - Result of decoding HCDH
decodeHeightClassDeltaHeightWithHuffman
()

6.5.6 if isHuffmanEncoded

private final void
decodeNewSymbols(final int symWidth, final int hcHeight, final Bitmap ibo, final int rdx, final int rdy)

private final void
decodeRefinedSymbol(final int symbolWidth, final int heightClassHeight)

private final void
decodeThroughTextRegion(final int symbolWidth, final int heightClassHeight, final long amountOfRefinementAggregationInstances)

public ArrayList<Bitmap>

Returns:

List of decoded symbol bitmaps as an ArrayList
getDictionary
()

Implements org.apache.pdfbox.jbig2.Dictionary.getDictionary.

6.5.5 Decoding the symbol dictionary

private int

Returns:

Result of computing SBSYMCODELEN
getSbSymCodeLen
()

6.5.8.2.3 - Setting SBSYMCODES and SBSYMCODELEN

private int[]
private HuffmanTable
getUserTable(final int tablePosition)

private final long
private final long
public void
init(final SegmentHeader
- The segments' header (to make referred-to segments available in data part).
header
,
final SubInputStream
- Wrapped ImageInputStream into SubInputStream.
sis
)

Implements org.apache.pdfbox.jbig2.SegmentData.init.

Parse the stream and read information of header.

private void
private void
private void
private void
readAtPixels(final int amountOfPixels)

private void
readRefinementAtPixels(final int amountOfAtPixels)

private void
private void
retrieveImportSymbols()

Concatenates symbols from all referred-to segments.

private void
private void
private void
setExportedSymbols(final int[] toExportFlags)

private void
private void
private void
private final void
setSymbolsArray()

6.5.8.2.4 - Setting SBSYMS

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aggInstTableback to summary
private HuffmanTable aggInstTable
amountOfDecodedSymbolsback to summary
private int amountOfDecodedSymbols
amountOfExportSymbolssback to summary
private int amountOfExportSymbolss

Number of exported symbols, 7.4.2.1.4

amountOfImportedSymbolssback to summary
private int amountOfImportedSymbolss
amountOfNewSymbolsback to summary
private int amountOfNewSymbols

Number of new symbols, 7.4.2.1.5

arithmeticDecoderback to summary
private ArithmeticDecoder arithmeticDecoder
bmSizeTableback to summary
private HuffmanTable bmSizeTable
cxback to summary
private CX cx
cxIAAIback to summary
private CX cxIAAI
cxIADHback to summary
private CX cxIADH
cxIADTback to summary
private CX cxIADT
cxIADWback to summary
private CX cxIADW
cxIAEXback to summary
private CX cxIAEX
cxIAIDback to summary
protected CX cxIAID
cxIARDXback to summary
private CX cxIARDX
cxIARDYback to summary
private CX cxIARDY
dhTableback to summary
private HuffmanTable dhTable

User-supplied tables *

dwTableback to summary
private HuffmanTable dwTable
exportSymbolsback to summary
private ArrayList<Bitmap> exportSymbols

Return value of that segment

genericRefinementRegionback to summary
private GenericRefinementRegion genericRefinementRegion
genericRegionback to summary
private GenericRegion genericRegion
iDecoderback to summary
private ArithmeticIntegerDecoder iDecoder
importSymbolsback to summary
private ArrayList<Bitmap> importSymbols
isCodingContextRetainedback to summary
private boolean isCodingContextRetained
isCodingContextUsedback to summary
private boolean isCodingContextUsed
isHuffmanEncodedback to summary
private boolean isHuffmanEncoded
newSymbolsback to summary
private Bitmap[] newSymbols
sbSymbolsback to summary
private ArrayList<Bitmap> sbSymbols
sbSymCodeLenback to summary
private int sbSymCodeLen
sdATXback to summary
private short[] sdATX

Symbol dictionary AT flags, 7.4.2.1.2

sdATYback to summary
private short[] sdATY
sdHuffAggInstanceSelectionback to summary
private short sdHuffAggInstanceSelection
sdHuffBMSizeSelectionback to summary
private short sdHuffBMSizeSelection
sdHuffDecodeHeightSelectionback to summary
private short sdHuffDecodeHeightSelection
sdHuffDecodeWidthSelectionback to summary
private short sdHuffDecodeWidthSelection
sdrATXback to summary
private short[] sdrATX

Symbol dictionary refinement AT flags, 7.4.2.1.3

sdrATYback to summary
private short[] sdrATY
sdrTemplateback to summary
private short sdrTemplate

Symbol dictionary flags, 7.4.2.1.1

sdTemplateback to summary
private byte sdTemplate
segmentHeaderback to summary
private SegmentHeader segmentHeader

Further parameters

subInputStreamback to summary
private SubInputStream subInputStream
textRegionback to summary
private TextRegion textRegion
useRefinementAggregationback to summary
private boolean useRefinementAggregation

Constructor Detail

SymbolDictionaryback to summary
public SymbolDictionary()
SymbolDictionaryback to summary
public SymbolDictionary(final SubInputStream subInputStream, final SegmentHeader segmentHeader) throws IOException

Method Detail

addSymbolback to summary
private final void addSymbol(final Region region) throws IntegerMaxValueException, InvalidHeaderValueException, IOException
checkInputback to summary
private void checkInput() throws InvalidHeaderValueException
decodeAggregateback to summary
private final void decodeAggregate(final int symbolWidth, final int heightClassHeight) throws IOException, InvalidHeaderValueException, IntegerMaxValueException
decodeDifferenceWidthback to summary
private final long decodeDifferenceWidth() throws IOException, InvalidHeaderValueException
decodeDirectlyThroughGenericRegionback to summary
private final void decodeDirectlyThroughGenericRegion(final int symWidth, final int hcHeight) throws IOException, IntegerMaxValueException, InvalidHeaderValueException
decodeHeightClassBitmapback to summary
private final void decodeHeightClassBitmap(final Bitmap heightClassCollectiveBitmap, final int heightClassFirstSymbol, final int heightClassHeight, final int[] newSymbolsWidths) throws IntegerMaxValueException, InvalidHeaderValueException, IOException
decodeHeightClassCollectiveBitmapback to summary
private final Bitmap decodeHeightClassCollectiveBitmap(final long bmSize, final int heightClassHeight, final int totalWidth) throws IOException
decodeHeightClassDeltaHeightback to summary
private final long decodeHeightClassDeltaHeight() throws IOException, InvalidHeaderValueException
decodeHeightClassDeltaHeightWithHuffmanback to summary
private final long decodeHeightClassDeltaHeightWithHuffman() throws IOException, InvalidHeaderValueException

6.5.6 if isHuffmanEncoded

Returns:long

long - Result of decoding HCDH

decodeNewSymbolsback to summary
private final void decodeNewSymbols(final int symWidth, final int hcHeight, final Bitmap ibo, final int rdx, final int rdy) throws IOException, InvalidHeaderValueException, IntegerMaxValueException
decodeRefinedSymbolback to summary
private final void decodeRefinedSymbol(final int symbolWidth, final int heightClassHeight) throws IOException, InvalidHeaderValueException, IntegerMaxValueException
decodeThroughTextRegionback to summary
private final void decodeThroughTextRegion(final int symbolWidth, final int heightClassHeight, final long amountOfRefinementAggregationInstances) throws IOException, IntegerMaxValueException, InvalidHeaderValueException
getDictionaryback to summary
public ArrayList<Bitmap> getDictionary() throws IOException, IntegerMaxValueException, InvalidHeaderValueException

Implements org.apache.pdfbox.jbig2.Dictionary.getDictionary.

6.5.5 Decoding the symbol dictionary

Returns:ArrayList<Bitmap>

List of decoded symbol bitmaps as an ArrayList

Exceptions
IOException:

Doc from org.apache.pdfbox.jbig2.Dictionary.getDictionary.

if an underlying IO operation fails

IntegerMaxValueException:

Doc from org.apache.pdfbox.jbig2.Dictionary.getDictionary.

if the maximum value limit of an integer is exceeded

InvalidHeaderValueException:

Doc from org.apache.pdfbox.jbig2.Dictionary.getDictionary.

if the segment header value is invalid

getSbSymCodeLenback to summary
private int getSbSymCodeLen() throws IOException

6.5.8.2.3 - Setting SBSYMCODES and SBSYMCODELEN

Returns:int

Result of computing SBSYMCODELEN

getToExportFlagsback to summary
private int[] getToExportFlags() throws IOException, InvalidHeaderValueException
getUserTableback to summary
private HuffmanTable getUserTable(final int tablePosition) throws InvalidHeaderValueException, IOException
huffDecodeBmSizeback to summary
private final long huffDecodeBmSize() throws IOException, InvalidHeaderValueException
huffDecodeRefAggNInstback to summary
private final long huffDecodeRefAggNInst() throws IOException, InvalidHeaderValueException
initback to summary
public void init(final SegmentHeader header, final SubInputStream sis) throws InvalidHeaderValueException, IntegerMaxValueException, IOException

Implements org.apache.pdfbox.jbig2.SegmentData.init.

Doc from org.apache.pdfbox.jbig2.SegmentData.init.

Parse the stream and read information of header.

Parameters
header:SegmentHeader

- The segments' header (to make referred-to segments available in data part).

sis:SubInputStream

- Wrapped ImageInputStream into SubInputStream.

Exceptions
InvalidHeaderValueException:
if the segment header value is invalid
IntegerMaxValueException:
if the maximum value limit of an integer is exceeded
IOException:
if an underlying IO operation fails
parseHeaderback to summary
private void parseHeader() throws IOException, InvalidHeaderValueException, IntegerMaxValueException
readAmountOfExportedSymbolsback to summary
private void readAmountOfExportedSymbols() throws IOException
readAmountOfNewSymbolsback to summary
private void readAmountOfNewSymbols() throws IOException
readAtPixelsback to summary
private void readAtPixels(final int amountOfPixels) throws IOException
readRefinementAtPixelsback to summary
private void readRefinementAtPixels(final int amountOfAtPixels) throws IOException
readRegionFlagsback to summary
private void readRegionFlags() throws IOException
retrieveImportSymbolsback to summary
private void retrieveImportSymbols() throws IOException, InvalidHeaderValueException, IntegerMaxValueException

Concatenates symbols from all referred-to segments.

setAtPixelsback to summary
private void setAtPixels() throws IOException
setCodingStatisticsback to summary
private void setCodingStatistics() throws IOException
setExportedSymbolsback to summary
private void setExportedSymbols(final int[] toExportFlags)
setInSymsback to summary
private void setInSyms() throws IOException, InvalidHeaderValueException, IntegerMaxValueException
setRefinementAtPixelsback to summary
private void setRefinementAtPixels() throws IOException
setRetainedCodingContextsback to summary
private void setRetainedCodingContexts(final SymbolDictionary sd)
setSymbolsArrayback to summary
private final void setSymbolsArray() throws IOException, InvalidHeaderValueException, IntegerMaxValueException

6.5.8.2.4 - Setting SBSYMS