Package com.inet.pdfc.config
Class PdfSource
- java.lang.Object
-
- com.inet.pdfc.config.PdfSource
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<PdfSource>
- Direct Known Subclasses:
ArrayPdfSource
,FilePdfSource
@JsonData public abstract class PdfSource extends java.lang.Object implements java.lang.Comparable<PdfSource>, java.io.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
KEY_LAST_MODIFIED
Last modified timestamp if known, hence zeroprotected static java.lang.String
KEY_NAME
Document file nameprotected static java.lang.String
KEY_PASSWORD
Document passwordprotected static java.lang.String
KEY_PATH
Document pathprotected static java.lang.String
KEY_SIZE
Size of the document if known, hence zero
-
Constructor Summary
Constructors Modifier Constructor Description PdfSource()
Deprecated.as of i-net PDFC 23.10 - use the protected constructorPdfSource(String, String, long, long)
insteadprotected
PdfSource(java.lang.String name, java.lang.String path, long lastModified, long size)
Creates the document source instance
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(PdfSource o)
boolean
equals(java.lang.Object obj)
abstract com.inet.persistence.RandomAccessRead
getContent()
Returns the readable content of this document sourcejava.lang.String
getLanguage()
Return the language for this documentlong
getLastModified()
Returns the time of the last modification to the document.protected java.util.Map<java.lang.String,java.lang.String>
getMetaProperties()
Returns the meta properties map to store any additional information to.java.lang.String
getName()
Returns the name of the PDF document.java.lang.String
getPassword()
Returns the user password to decode the PDF sourcejava.lang.String
getPath()
Get the path of this document, if one exist.long
getSize()
Returns the size of the raw data in bytesint
hashCode()
void
setLanguage(java.lang.String language)
Set the language for this documentvoid
setPageLimit(int pageLimited)
Set the maximal number of pages the document source will returnvoid
setPassword(java.lang.String password)
Sets the user password to decode the PDF source
-
-
-
Field Detail
-
KEY_PASSWORD
protected static final java.lang.String KEY_PASSWORD
Document password- See Also:
- Constant Field Values
-
KEY_NAME
protected static final java.lang.String KEY_NAME
Document file name- See Also:
- Constant Field Values
-
KEY_PATH
protected static final java.lang.String KEY_PATH
Document path- See Also:
- Constant Field Values
-
KEY_LAST_MODIFIED
protected static final java.lang.String KEY_LAST_MODIFIED
Last modified timestamp if known, hence zero- See Also:
- Constant Field Values
-
KEY_SIZE
protected static final java.lang.String KEY_SIZE
Size of the document if known, hence zero- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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
protected PdfSource(java.lang.String name, java.lang.String path, long lastModified, long size)
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 Detail
-
setLanguage
public void setLanguage(java.lang.String language)
Set the language for this document- Parameters:
language
- the language for this document- Since:
- 5.0
-
getLanguage
public java.lang.String 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
public java.lang.String 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
public java.lang.String 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
public abstract com.inet.persistence.RandomAccessRead getContent() throws java.io.IOException
Returns the readable content of this document source- Returns:
- the readable content of this document source
- Throws:
java.io.IOException
- thrown in case the source data cannot be accessed or does not exist- Since:
- 21.10
-
getPassword
public java.lang.String getPassword()
Returns the user password to decode the PDF source- Returns:
- the user password, may be
null
for none - Since:
- 3.0
-
setPassword
public void setPassword(java.lang.String password)
Sets the user password to decode the PDF source- Parameters:
password
- the user password, may benull
for none- Since:
- 3.0
-
getMetaProperties
protected java.util.Map<java.lang.String,java.lang.String> 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
public int compareTo(PdfSource o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<PdfSource>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-