public class MemoryLimitsAwareHandler extends Object
MemoryLimitsAwareHandler
handles memory allocation and prevents decompressed pdf streams from occupation of more space than allowed.
A configured MemoryLimitsAwareHandler can be set as a property of ReaderProperties
instance which is passed to PdfReader
.
Constructor and Description |
---|
MemoryLimitsAwareHandler()
Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams.
|
MemoryLimitsAwareHandler(long documentSize)
Creates a MemoryLimitsAwareHandler which will be used to handle decompression of pdf streams.
|
Modifier and Type | Method and Description |
---|---|
void |
checkIfXrefStructureExceedsTheLimit(int requestedCapacity)
Performs a check of possible extension of xref structure.
|
int |
getMaxNumberOfElementsInXrefStructure()
Gets maximum number of elements in xref structure.
|
long |
getMaxSizeOfDecompressedPdfStreamsSum()
Gets the maximum allowed size which can be occupied by all decompressed pdf streams.
|
int |
getMaxSizeOfSingleDecompressedPdfStream()
Gets the maximum allowed size which can be occupied by a single decompressed pdf stream.
|
boolean |
isMemoryLimitsAwarenessRequiredOnDecompression(PdfArray filters)
Performs a check if the PdfStream with provided setup of the filters requires memory limits awareness during decompression.
|
void |
setMaxNumberOfElementsInXrefStructure(int maxNumberOfElementsInXrefStructure)
Sets maximum number of elements in xref structure.
|
MemoryLimitsAwareHandler |
setMaxSizeOfDecompressedPdfStreamsSum(long maxSizeOfDecompressedPdfStreamsSum)
Sets the maximum allowed size which can be occupied by all decompressed pdf streams.
|
MemoryLimitsAwareHandler |
setMaxSizeOfSingleDecompressedPdfStream(int maxSizeOfSingleDecompressedPdfStream)
Sets the maximum allowed size which can be occupied by a single decompressed pdf stream.
|
public MemoryLimitsAwareHandler()
MemoryLimitsAwareHandler
which will be used to handle decompression of pdf streams. The max allowed memory limits will be generated by default.
public MemoryLimitsAwareHandler(long documentSize)
MemoryLimitsAwareHandler
which will be used to handle decompression of pdf streams. The max allowed memory limits will be generated by default, based on the size of the document.
documentSize
- the size of the document, which is going to be handled by iText.
public int getMaxSizeOfSingleDecompressedPdfStream()
public MemoryLimitsAwareHandler setMaxSizeOfSingleDecompressedPdfStream(int maxSizeOfSingleDecompressedPdfStream)
iText will throw an exception if during decompression a pdf stream which was identified as requiring memory limits awareness occupies more memory than allowed.
maxSizeOfSingleDecompressedPdfStream
- the maximum allowed size which can be occupied by a single decompressed pdf stream.
MemoryLimitsAwareHandler
instance.
isMemoryLimitsAwarenessRequiredOnDecompression(PdfArray)
public long getMaxSizeOfDecompressedPdfStreamsSum()
public MemoryLimitsAwareHandler setMaxSizeOfDecompressedPdfStreamsSum(long maxSizeOfDecompressedPdfStreamsSum)
iText will throw an exception if during decompression pdf streams which were identified as requiring memory limits awareness occupy more memory than allowed.
maxSizeOfDecompressedPdfStreamsSum
- he maximum allowed size which can be occupied by all decompressed pdf streams.
MemoryLimitsAwareHandler
instance.
isMemoryLimitsAwarenessRequiredOnDecompression(PdfArray)
public boolean isMemoryLimitsAwarenessRequiredOnDecompression(PdfArray filters)
PdfStream
with provided setup of the filters requires memory limits awareness during decompression.
filters
- is an PdfArray
of names of filters
public int getMaxNumberOfElementsInXrefStructure()
public void setMaxNumberOfElementsInXrefStructure(int maxNumberOfElementsInXrefStructure)
maxNumberOfElementsInXrefStructure
- maximum number of elements in xref structure.
public void checkIfXrefStructureExceedsTheLimit(int requestedCapacity)
requestedCapacity
- capacity to which we need to expand xref array.
Copyright © 1998–2022 iText Group NV. All rights reserved.