Package com.inet.pdfc.config
Class PdfSource
java.lang.Object
com.inet.pdfc.config.PdfSource
- All Implemented Interfaces:
Serializable
,Comparable<PdfSource>
- Direct Known Subclasses:
ArrayPdfSource
,FilePdfSource
@JsonData
public abstract class PdfSource
extends Object
implements Comparable<PdfSource>, Serializable
This is an abstraction for raw PDF documents. It provides access to the raw content of the document as well as the
most basic meta data.
- Since:
- 3.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Last modified timestamp if known, hence zeroprotected static final String
Document file nameprotected static final String
Document passwordprotected static final String
Document pathprotected static final String
Size of the document if known, hence zero -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
abstract com.inet.persistence.RandomAccessRead
Returns the readable content of this document sourceReturn the language for this documentlong
Returns the time of the last modification to the document.Returns the meta properties map to store any additional information to.getName()
Returns the name of the PDF document.Returns the user password to decode the PDF sourcegetPath()
Get the path of this document, if one exist.long
getSize()
Returns the size of the raw data in bytesint
hashCode()
void
setLanguage
(String language) Set the language for this documentvoid
setPageLimit
(int pageLimited) Set the maximal number of pages the document source will returnvoid
setPassword
(String password) Sets the user password to decode the PDF source
-
Field Details
-
KEY_PASSWORD
Document password- See Also:
-
KEY_NAME
Document file name- See Also:
-
KEY_PATH
Document path- See Also:
-
KEY_LAST_MODIFIED
Last modified timestamp if known, hence zero- See Also:
-
KEY_SIZE
Size of the document if known, hence zero- See Also:
-
-
Constructor Details
-
PdfSource
public PdfSource()Deprecated.As of i-net PDFC 23.10 - use the protected constructorPdfSource(String, String, long, long)
insteadCreates an empty document with no name, no path, a size of 0 bytes and a last modified of 1st of January 1970.- Since:
- 3.0
-
PdfSource
Creates the document source instance- Parameters:
name
- the name of the document (usually the file name, not the title set in the meta data of the document)path
- the path of the documentlastModified
- the last modified time stampsize
- the size in bytes- Since:
- 23.10
-
-
Method Details
-
setLanguage
Set the language for this document- Parameters:
language
- the language for this document- Since:
- 5.0
-
getLanguage
Return the language for this document- Returns:
- the language for this document
- Since:
- 5.0
-
setPageLimit
public void setPageLimit(int pageLimited) Set the maximal number of pages the document source will return- Parameters:
pageLimited
- the maximum number of pages to read, if >=0, there will be no limit- Since:
- 4.0
-
getName
Returns the name of the PDF document. This may be the original file name for instance of the name provided in the meta data of the document. It will be used to reference the document in reports or log output.- Returns:
- the name of the document, never
null
- Since:
- 3.0
-
getPath
Get the path of this document, if one exist. If no existing path, it give null back.- Returns:
- return the path of the document or null if no path exist
- Since:
- 4.0
-
getLastModified
public long getLastModified()Returns the time of the last modification to the document. It's only used for report generation an has no impact on the comparison.- Returns:
- the last modified timestamp of the document; interpreted as milliseconds since the beginning of 1970
- Since:
- 3.0
-
getSize
public long getSize()Returns the size of the raw data in bytes- Returns:
- the size of the raw data in bytes
- Since:
- 3.0
-
getContent
Returns the readable content of this document source- Returns:
- the readable content of this document source
- Throws:
IOException
- thrown in case the source data cannot be accessed or does not exist- Since:
- 21.10
-
getPassword
Returns the user password to decode the PDF source- Returns:
- the user password, may be
null
for none - Since:
- 3.0
-
setPassword
Sets the user password to decode the PDF source- Parameters:
password
- the user password, may benull
for none- Since:
- 3.0
-
getMetaProperties
Returns the meta properties map to store any additional information to. Please consider using this map instead of instance fields for additional information.- Returns:
- the meta properties, not
null
- Since:
- 4.0
-
compareTo
- Specified by:
compareTo
in interfaceComparable<PdfSource>
-
equals
-
hashCode
public int hashCode()
-
PdfSource(String, String, long, long)
instead