com.qoppa.pdf.source
Class ByteArrayPDFSource

java.lang.Object
  extended by com.qoppa.pdf.source.ByteArrayPDFSource
All Implemented Interfaces:
PDFSource

public class ByteArrayPDFSource
extends Object
implements PDFSource

Implementation of the PDFSource interface when the document comes from a byte array.

Author:
Qoppa Software

Constructor Summary
ByteArrayPDFSource(byte[] content)
          Constructs a source that uses a byte array to hold the PDF content.
ByteArrayPDFSource(byte[] content, String name, String path)
          Constructs a source that uses a byte array to hold the PDF content.
 
Method Summary
 boolean equals(PDFSource other)
          Tests if this source is equal to another source.
 byte[] getBytes()
          Returns the array of bytes that backs this PDF source.
 PDFContent getContent()
          Returns an object that implements PDFContent, that contains and can deliver the contents of the PDF document.
 String getName()
          Returns the name of the document.
 String getPath()
          Returns the full path to the document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayPDFSource

public ByteArrayPDFSource(byte[] content)
Constructs a source that uses a byte array to hold the PDF content. The name and path of the source will be set to null when this constructor is used.

Parameters:
content - The byte array that holds the PDF content.

ByteArrayPDFSource

public ByteArrayPDFSource(byte[] content,
                          String name,
                          String path)
Constructs a source that uses a byte array to hold the PDF content. The name and path of the PDF source will be initialized to the arguments.

Parameters:
content - The byte array that holds the PDF content.
name - THe name of the source, returned by the getName() method
path - THe path to the source, returned by the getPath() method.
Method Detail

equals

public boolean equals(PDFSource other)
Description copied from interface: PDFSource
Tests if this source is equal to another source.

Specified by:
equals in interface PDFSource

getBytes

public byte[] getBytes()
Returns the array of bytes that backs this PDF source.

Returns:
The array of bytes that holds the PDF content.

getContent

public PDFContent getContent()
Description copied from interface: PDFSource
Returns an object that implements PDFContent, that contains and can deliver the contents of the PDF document.

Specified by:
getContent in interface PDFSource
Returns:
Returns an object that implements the PDFContent interface.

getPath

public String getPath()
Description copied from interface: PDFSource
Returns the full path to the document. The path of the document should normally be sufficient to uniquely identify the document. If the source is a file, the path is the full path to the file.

Specified by:
getPath in interface PDFSource

getName

public String getName()
Description copied from interface: PDFSource
Returns the name of the document. The name of the document is normally the file name.

Specified by:
getName in interface PDFSource