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

public Class TextRegion

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

This class represented the segment type "Text region", 7.4.3, page 56.

Field Summary

Modifier and TypeField and Description
private long
amountOfSymbolInstances

Number of symbol instances, 7.4.3.1.4

private int
private ArithmeticDecoder
private CombinationOperator
private long
currentS

Further parameters

private CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private short
private HuffmanTable
private HuffmanTable
fsTable

User-supplied tables *

private GenericRefinementRegion
private ArithmeticIntegerDecoder
private boolean
private short
private short
private HuffmanTable
private HuffmanTable
private HuffmanTable
private HuffmanTable
private short
private Bitmap
private RegionSegmentInformation
regionInfo

Region segment information field, 7.4.1

private HuffmanTable
private short
private short
private short
private short
private short
private short
private short
private short
private short
sbHuffRSize

Text region segment Huffman flags, 7.4.3.1.2

private short[]
sbrATX

Text region refinement AT flags, 7.4.3.1.3

private short[]
private short
sbrTemplate

Text region segment flags, 7.4.3.1.1

private int
private SegmentHeader
private SubInputStream
private int
symbolCodeLength

codeTable including a code to each symbol used in that region

private FixedSizeTable
private ArrayList<Bitmap>
private HuffmanTable
private boolean

Constructor Summary

AccessConstructor and Description
public
public
TextRegion(SubInputStream subInputStream, SegmentHeader segmentHeader)

Method Summary

Modifier and TypeMethod and Description
private final void
blit(Bitmap ib, long t)

private void
private void
private void
private final long
private final long
private final long
private final Bitmap
decodeIb(long r, long id)

private final long
private final long
private final long
private final long
private final long
private final long
private final long
private final long
private void
private final long
public Bitmap
getRegionBitmap()

Implements org.apache.pdfbox.jbig2.Region.getRegionBitmap.

Decodes and returns a regions content.

public RegionSegmentInformation
private void
private HuffmanTable
getUserTable(final int tablePosition)

public void
init(SegmentHeader
- The segments' header (to make referred-to segments available in data part).
header
,
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
private void
private void
private void
protected void
setContexts(CX cx, CX cxIADT, CX cxIAFS, CX cxIADS, CX cxIAIT, CX cxIAID, CX cxIARDW, CX cxIARDH, CX cxIARDX, CX cxIARDY)

protected void
setParameters(ArithmeticDecoder arithmeticDecoder, ArithmeticIntegerDecoder iDecoder, boolean isHuffmanEncoded, boolean sbRefine, int sbw, int sbh, long sbNumInstances, int sbStrips, int sbNumSyms, short sbDefaultPixel, short sbCombinationOperator, short transposed, short refCorner, short sbdsOffset, short sbHuffFS, short sbHuffDS, short sbHuffDT, short sbHuffRDWidth, short sbHuffRDHeight, short sbHuffRDX, short sbHuffRDY, short sbHuffRSize, short sbrTemplate, short[] sbrATX, short[] sbrATY, ArrayList<Bitmap> sbSyms, int sbSymCodeLen)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

amountOfSymbolInstancesback to summary
private long amountOfSymbolInstances

Number of symbol instances, 7.4.3.1.4

amountOfSymbolsback to summary
private int amountOfSymbols
arithmeticDecoderback to summary
private ArithmeticDecoder arithmeticDecoder
combinationOperatorback to summary
private CombinationOperator combinationOperator
currentSback to summary
private long currentS

Further parameters

cxback to summary
private CX cx
cxIADSback to summary
private CX cxIADS
cxIADTback to summary
private CX cxIADT
cxIAFSback to summary
private CX cxIAFS
cxIAIDback to summary
private CX cxIAID
cxIAITback to summary
private CX cxIAIT
cxIARDHback to summary
private CX cxIARDH
cxIARDWback to summary
private CX cxIARDW
cxIARDXback to summary
private CX cxIARDX
cxIARDYback to summary
private CX cxIARDY
cxIARIback to summary
private CX cxIARI
defaultPixelback to summary
private short defaultPixel
dsTableback to summary
private HuffmanTable dsTable
fsTableback to summary
private HuffmanTable fsTable

User-supplied tables *

genericRefinementRegionback to summary
private GenericRefinementRegion genericRefinementRegion
integerDecoderback to summary
private ArithmeticIntegerDecoder integerDecoder
isHuffmanEncodedback to summary
private boolean isHuffmanEncoded
isTransposedback to summary
private short isTransposed
logSBStripsback to summary
private short logSBStrips
rdhTableback to summary
private HuffmanTable rdhTable
rdwTableback to summary
private HuffmanTable rdwTable
rdxTableback to summary
private HuffmanTable rdxTable
rdyTableback to summary
private HuffmanTable rdyTable
referenceCornerback to summary
private short referenceCorner
regionBitmapback to summary
private Bitmap regionBitmap
regionInfoback to summary
private RegionSegmentInformation regionInfo

Region segment information field, 7.4.1

rSizeTableback to summary
private HuffmanTable rSizeTable
sbdsOffsetback to summary
private short sbdsOffset
sbHuffDSback to summary
private short sbHuffDS
sbHuffDTback to summary
private short sbHuffDT
sbHuffFSback to summary
private short sbHuffFS
sbHuffRDHeightback to summary
private short sbHuffRDHeight
sbHuffRDWidthback to summary
private short sbHuffRDWidth
sbHuffRDXback to summary
private short sbHuffRDX
sbHuffRDYback to summary
private short sbHuffRDY
sbHuffRSizeback to summary
private short sbHuffRSize

Text region segment Huffman flags, 7.4.3.1.2

sbrATXback to summary
private short[] sbrATX

Text region refinement AT flags, 7.4.3.1.3

sbrATYback to summary
private short[] sbrATY
sbrTemplateback to summary
private short sbrTemplate

Text region segment flags, 7.4.3.1.1

sbStripsback to summary
private int sbStrips
segmentHeaderback to summary
private SegmentHeader segmentHeader
subInputStreamback to summary
private SubInputStream subInputStream
symbolCodeLengthback to summary
private int symbolCodeLength

codeTable including a code to each symbol used in that region

symbolCodeTableback to summary
private FixedSizeTable symbolCodeTable
symbolsback to summary
private ArrayList<Bitmap> symbols
tableback to summary
private HuffmanTable table
useRefinementback to summary
private boolean useRefinement

Constructor Detail

TextRegionback to summary
public TextRegion()
TextRegionback to summary
public TextRegion(SubInputStream subInputStream, SegmentHeader segmentHeader)

Method Detail

blitback to summary
private final void blit(Bitmap ib, long t)
checkInputback to summary
private void checkInput() throws InvalidHeaderValueException
computeSymbolCodeLengthback to summary
private void computeSymbolCodeLength() throws IOException
createRegionBitmapback to summary
private void createRegionBitmap()
decodeCurrentTback to summary
private final long decodeCurrentT() throws IOException
decodeDfSback to summary
private final long decodeDfS() throws IOException, InvalidHeaderValueException
decodeDTback to summary
private final long decodeDT() throws IOException
decodeIbback to summary
private final Bitmap decodeIb(long r, long id) throws IOException, InvalidHeaderValueException, IntegerMaxValueException
decodeIDback to summary
private final long decodeID() throws IOException
decodeIdSback to summary
private final long decodeIdS() throws IOException, InvalidHeaderValueException
decodeRdhback to summary
private final long decodeRdh() throws IOException, InvalidHeaderValueException
decodeRdwback to summary
private final long decodeRdw() throws IOException, InvalidHeaderValueException
decodeRdxback to summary
private final long decodeRdx() throws IOException, InvalidHeaderValueException
decodeRdyback to summary
private final long decodeRdy() throws IOException, InvalidHeaderValueException
decodeRIback to summary
private final long decodeRI() throws IOException
decodeStripTback to summary
private final long decodeStripT() throws IOException, InvalidHeaderValueException
decodeSymbolInstancesback to summary
private void decodeSymbolInstances() throws IOException, InvalidHeaderValueException, IntegerMaxValueException
decodeSymInRefSizeback to summary
private final long decodeSymInRefSize() throws IOException, InvalidHeaderValueException
getRegionBitmapback to summary
public Bitmap getRegionBitmap() throws IOException, IntegerMaxValueException, InvalidHeaderValueException

Implements org.apache.pdfbox.jbig2.Region.getRegionBitmap.

Doc from org.apache.pdfbox.jbig2.Region.getRegionBitmap.

Decodes and returns a regions content.

Returns:Bitmap

The decoded region as Bitmap.

Exceptions
IOException:
if an underlying IO operation fails
IntegerMaxValueException:
if the maximum value limit of an integer is exceeded
InvalidHeaderValueException:
if the segment header value is invalid
getRegionInfoback to summary
public RegionSegmentInformation getRegionInfo()

Implements org.apache.pdfbox.jbig2.Region.getRegionInfo.

Doc from org.apache.pdfbox.jbig2.Region.getRegionInfo.

Simply returns the RegionSegmentInformation.

Returns:RegionSegmentInformation

The RegionSegmentInformation.

getSymbolsback to summary
private void getSymbols() throws IOException, IntegerMaxValueException, InvalidHeaderValueException
getUserTableback to summary
private HuffmanTable getUserTable(final int tablePosition) throws InvalidHeaderValueException, IOException
initback to summary
public void init(SegmentHeader header, 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
initSymbolsback to summary
private void initSymbols() throws IOException, IntegerMaxValueException, InvalidHeaderValueException
parseHeaderback to summary
private void parseHeader() throws IOException, InvalidHeaderValueException, IntegerMaxValueException
readAmountOfSymbolInstancesback to summary
private void readAmountOfSymbolInstances() throws IOException
readHuffmanFlagsback to summary
private void readHuffmanFlags() throws IOException
readRegionFlagsback to summary
private void readRegionFlags() throws IOException
readUseRefinementback to summary
private void readUseRefinement() throws IOException
setCodingStatisticsback to summary
private void setCodingStatistics() throws IOException
setContextsback to summary
protected void setContexts(CX cx, CX cxIADT, CX cxIAFS, CX cxIADS, CX cxIAIT, CX cxIAID, CX cxIARDW, CX cxIARDH, CX cxIARDX, CX cxIARDY)
setParametersback to summary
protected void setParameters(ArithmeticDecoder arithmeticDecoder, ArithmeticIntegerDecoder iDecoder, boolean isHuffmanEncoded, boolean sbRefine, int sbw, int sbh, long sbNumInstances, int sbStrips, int sbNumSyms, short sbDefaultPixel, short sbCombinationOperator, short transposed, short refCorner, short sbdsOffset, short sbHuffFS, short sbHuffDS, short sbHuffDT, short sbHuffRDWidth, short sbHuffRDHeight, short sbHuffRDX, short sbHuffRDY, short sbHuffRSize, short sbrTemplate, short[] sbrATX, short[] sbrATY, ArrayList<Bitmap> sbSyms, int sbSymCodeLen)
symbolIDCodeLengthsback to summary
private void symbolIDCodeLengths() throws IOException