public abstract class AbstractDocument extends Object implements Document, Serializable
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
content
Content of the document.
|
static int |
READ_BUFFER_SIZE
Buffer size used while reading (loading) document content.
|
TYPE_PDF, TYPE_POSTSCRIPT| Constructor and Description |
|---|
AbstractDocument() |
| Modifier and Type | Method and Description |
|---|---|
void |
append(Document document)
Append pages of another document to the current document.
|
protected void |
assertValidPageIndex(int index)
Assert the given page index is valid for the current document.
|
protected void |
assertValidPageRange(int begin,
int end)
Assert the given page range is valid for the current document.
|
List<Document> |
explode()
Separate each pages to a new document.
|
byte[] |
getContent()
Return document content as a byte array
|
int |
getSize()
Return document size
|
void |
load(File file)
Load document from a File.
|
void |
load(InputStream inputStream)
Load document from an InputStream.
|
void |
write(File file)
Write document to a File.
|
void |
write(OutputStream outputStream)
Write document to an OutputStream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitextract, getPageCount, getTypepublic static final int READ_BUFFER_SIZE
protected byte[] content
public void load(File file) throws FileNotFoundException, IOException
Documentload in interface Documentfile - File.FileNotFoundExceptionIOExceptionpublic void load(InputStream inputStream) throws IOException
Documentload in interface DocumentIOExceptionpublic void write(File file) throws IOException
Documentwrite in interface Documentfile - File.IOExceptionpublic void write(OutputStream outputStream) throws IOException
Documentwrite in interface DocumentIOExceptionpublic int getSize()
Documentpublic byte[] getContent()
DocumentgetContent in interface Documentprotected void assertValidPageIndex(int index)
throws DocumentException
index - Index to checkDocumentException - Thrown if index is not validprotected void assertValidPageRange(int begin,
int end)
throws DocumentException
begin - Range begin indexend - Range end indexDocumentExceptionpublic void append(Document document) throws DocumentException
Documentappend in interface Documentdocument - Document ot appendDocumentExceptionpublic List<Document> explode() throws DocumentException
Documentexplode in interface DocumentDocumentExceptionCopyright © 2016. All Rights Reserved.