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_NAME
Pdf Nameprotected static java.lang.String
KEY_PASSWORD
Pdf Passwordprotected static java.lang.String
KEY_PATH
Pdf Path
-
Constructor Summary
Constructors Constructor Description PdfSource()
-
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 documentabstract long
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.abstract 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
Pdf Password- See Also:
- Constant Field Values
-
KEY_NAME
protected static final java.lang.String KEY_NAME
Pdf Name- See Also:
- Constant Field Values
-
KEY_PATH
protected static final java.lang.String KEY_PATH
Pdf Path- See Also:
- Constant Field Values
-
-
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 abstract 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 abstract 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
-
-