Package eu.europa.esig.dss.pdf
Class PdfMemoryUsageSetting
java.lang.Object
eu.europa.esig.dss.pdf.PdfMemoryUsageSetting
Represents the PDF document loading setting on signature creation or validation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
MemoryUsageSetting's load options -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Default constructorprotected
PdfMemoryUsageSetting
(PdfMemoryUsageSetting.Mode mode, long maxMemoryBytes, long maxStorageBytes) Constructor with memory allocation parameters -
Method Summary
Modifier and TypeMethodDescriptionstatic PdfMemoryUsageSetting
fileOnly()
It represents file only unrestricted allocation size load mode.static PdfMemoryUsageSetting
fileOnly
(long maxStorageBytes) It represents file only unrestricted allocation size load mode.long
Gets the maximum number of bytes to be allocated in memory.long
Gets the maximum number of bytes to be allocated in both memory and temporary file.getMode()
Gets the PDF memory usage modestatic PdfMemoryUsageSetting
It represents memory unrestricted allocation size load mode.static PdfMemoryUsageSetting
memoryBuffered
(long maxBytes) It represents memory unrestricted allocation size load mode.static PdfMemoryUsageSetting
It represents a memory-forced type of handling.static PdfMemoryUsageSetting
mixed
(long maxMemoryBytes) It represents mixed memory-first unrestricted file allocation size load mode.static PdfMemoryUsageSetting
mixed
(long maxMemoryBytes, long maxStorageBytes) It represents mixed memory-first restricted file allocation size load mode.toString()
-
Constructor Details
-
PdfMemoryUsageSetting
Default constructor- Parameters:
mode
-PdfMemoryUsageSetting.Mode
the memory handling mode
-
PdfMemoryUsageSetting
protected PdfMemoryUsageSetting(PdfMemoryUsageSetting.Mode mode, long maxMemoryBytes, long maxStorageBytes) Constructor with memory allocation parameters- Parameters:
mode
-PdfMemoryUsageSetting.Mode
the memory handling modemaxMemoryBytes
- the maximum number of bytes to be allocated in memorymaxStorageBytes
- the maximum number of bytes to be allocated both in memory and in a temporary file
-
-
Method Details
-
getMode
Gets the PDF memory usage mode- Returns:
- MemoryUsageSetting's load option
PdfMemoryUsageSetting.Mode
-
getMaxMemoryBytes
public long getMaxMemoryBytes()Gets the maximum number of bytes to be allocated in memory. NOTE: applicable only when mode isMode.MEMORY
orMode.MIXED
(implementation dependent)- Returns:
- max bytes to be loaded into memory
-
getMaxStorageBytes
public long getMaxStorageBytes()Gets the maximum number of bytes to be allocated in both memory and temporary file. NOTE: applicable only when mode isMode.FILE
orMode.MIXED
(implementation dependent)- Returns:
- max bytes to be loaded into file
-
memoryFull
It represents a memory-forced type of handling. When chosen, the File is read and loaded to a byte array before processing.- Returns:
- the PDF document load setting
PdfMemoryUsageSetting
-
memoryBuffered
It represents memory unrestricted allocation size load mode. When this method is chosen, the file is loaded to the memory, as needed.- Returns:
- the PDF document load setting
PdfMemoryUsageSetting
-
memoryBuffered
It represents memory unrestricted allocation size load mode. When this method is chosen, the file is loaded to the memory, as needed.- Parameters:
maxBytes
- max allocation size- Returns:
- the PDF document load setting
PdfMemoryUsageSetting
-
fileOnly
It represents file only unrestricted allocation size load mode. When this method is chosen, the content of a file is stored in a temporary file in filesystem.- Returns:
- the PDF document load setting
PdfMemoryUsageSetting
-
fileOnly
It represents file only unrestricted allocation size load mode. When this method is chosen, the content of a file is stored in a temporary file in filesystem.- Parameters:
maxStorageBytes
- max allocation size- Returns:
- the PDF document load setting
PdfMemoryUsageSetting
-
mixed
It represents mixed memory-first unrestricted file allocation size load mode. When this mode is chosen, the content of file is stored in memory before exceeding ofmaxMemoryBytes
, and the rest is stored in a temporary file in a filesystem.- Parameters:
maxMemoryBytes
- max memory allocation size- Returns:
- the PDF document load setting
PdfMemoryUsageSetting
-
mixed
It represents mixed memory-first restricted file allocation size load mode. When this mode is chosen, the content of file is stored in memory before exceeding ofmaxMemoryBytes
, and the rest is stored in a temporary file in a filesystem.- Parameters:
maxMemoryBytes
- max memory allocation sizemaxStorageBytes
- max size the memory and temporary file may have together- Returns:
- the PDF document load setting
PdfMemoryUsageSetting
-
toString
-