com.qoppa.pdf.annotations
Interface FileAttachment

All Superinterfaces:
Annotation

public interface FileAttachment
extends Annotation

Interface representing a File Attachment annotation in a PDF document.

Author:
Qoppa Software

Field Summary
static String ICON_DEFAULT
           
static String ICON_GRAPH
           
static String ICON_PAPERCLIP
           
static String ICON_PUSHPIN
           
static String ICON_TAG
           
 
Fields inherited from interface com.qoppa.pdf.annotations.Annotation
BORDERSTYLE_BEVELED, BORDERSTYLE_DASHED, BORDERSTYLE_INSETS, BORDERSTYLE_SOLID, BORDERSTYLE_UNDERLINE, FLAGS_HIDDEN, FLAGS_INVISIBLE, FLAGS_LOCKED, FLAGS_NOROTATE, FLAGS_NOVIEW, FLAGS_NOZOOM, FLAGS_PRINTABLE, FLAGS_READONLY
 
Method Summary
 byte[] getCheckSum()
          Returns the CRC checksum for the file contents.
 byte[] getDeflatedContents()
          Returns the file contents in deflated format
 String getFileName()
          Returns the name of the file.
 int getFileSize()
          Returns the length of the file, in bytes.
 String getIconName()
          Returns the name of the icon for this annotation.
 InputStream getInputStream()
          Returns the file contents as an input stream.
 String getPopupText()
          Returns the text that is displayed when the mouse hovers over the annotation.
 void saveFile(File outFile)
          Saves the content of the file to a file.
 void setFileContents(byte[] fileContents)
          Sets the file contents for the file attachment.
 void setFileContents(File file)
          Sets the file contents for the file attachment from a file.
 void setFileContents(InputStream inStream)
          Sets the file contents for this file attachment from an input stream.
 void setFileName(String fileName)
          Sets the name of the attached file.
 void setIconName(String iconName)
          Sets the icon name used when displaying this annotation.
 void setPopupText(String popupText)
          Sets the text that is displayed when the mouse hovers over the annotation.
 void writeContents(OutputStream outStream)
          Write the contents of the file attachment to an output stream
 
Methods inherited from interface com.qoppa.pdf.annotations.Annotation
getActions, getBorderStyle, getBorderWidth, getColor, getComponent, getContents, getCreationDate, getCreator, getFlags, getModifiedDate, getName, getOpacity, getRectangle, getSubject, getSubtype, getTriggerActions, isHidden, isInvisible, isLocked, isNoRotate, isNoView, isNoZoom, isPrintable, isReadOnly, paint, paint, print, revalidate, setActions, setBorderStyle, setBorderWidth, setColor, setComponent, setComponentVisible, setCreationDate, setCreator, setFlags, setHidden, setInvisible, setLayer, setLocked, setModifiedDate, setName, setNoRotate, setNoView, setNoZoom, setOpacity, setPrintable, setReadOnly, setRectangle, setSubject, setSubtype, setTriggerActions, shiftRectangle
 

Field Detail

ICON_GRAPH

static final String ICON_GRAPH
See Also:
Constant Field Values

ICON_PAPERCLIP

static final String ICON_PAPERCLIP
See Also:
Constant Field Values

ICON_PUSHPIN

static final String ICON_PUSHPIN
See Also:
Constant Field Values

ICON_TAG

static final String ICON_TAG
See Also:
Constant Field Values

ICON_DEFAULT

static final String ICON_DEFAULT
See Also:
Constant Field Values
Method Detail

getIconName

String getIconName()
Returns the name of the icon for this annotation.

Returns:
Name of the icon.

getPopupText

String getPopupText()
Returns the text that is displayed when the mouse hovers over the annotation.

Returns:
Popup text.

setPopupText

void setPopupText(String popupText)
Sets the text that is displayed when the mouse hovers over the annotation.

Parameters:
popupText - The new text string.

setIconName

void setIconName(String iconName)
Sets the icon name used when displaying this annotation.

Parameters:
iconName - The name of the icon to use when displaying the annotation in its un-opened mode. Please use one of the constants defined in this class (ICON_XXXX) to set the name of the icon.

setFileContents

void setFileContents(byte[] fileContents)
                     throws PDFException,
                            IOException
Sets the file contents for the file attachment.

Parameters:
fileContents - The new file contents.
Throws:
PDFException
IOException

setFileContents

void setFileContents(File file)
                     throws PDFException,
                            IOException
Sets the file contents for the file attachment from a file.

Parameters:
file - The file to read the contents from.
Throws:
PDFException
IOException

setFileContents

void setFileContents(InputStream inStream)
                     throws PDFException,
                            IOException
Sets the file contents for this file attachment from an input stream. The method will read the entire input stream to set the file contents.

Throws:
PDFException
IOException

getFileName

String getFileName()
Returns the name of the file.

Returns:
The name of the file attached.

setFileName

void setFileName(String fileName)
Sets the name of the attached file.

Parameters:
fileName - The name of the file.

getFileSize

int getFileSize()
                throws IOException,
                       PDFException
Returns the length of the file, in bytes.

Returns:
The file length.
Throws:
IOException
PDFException

getDeflatedContents

byte[] getDeflatedContents()
                           throws IOException,
                                  PDFException
Returns the file contents in deflated format

Throws:
IOException
PDFException

getInputStream

InputStream getInputStream()
                           throws IOException,
                                  PDFException
Returns the file contents as an input stream.

Throws:
IOException
PDFException

getCheckSum

byte[] getCheckSum()
                   throws PDFException,
                          IOException
Returns the CRC checksum for the file contents.

Returns:
CRC
Throws:
PDFException
IOException

writeContents

void writeContents(OutputStream outStream)
                   throws IOException
Write the contents of the file attachment to an output stream

Throws:
IOException

saveFile

void saveFile(File outFile)
              throws IOException,
                     PDFException
Saves the content of the file to a file.

Parameters:
outFile - the file to save to.
Throws:
IOException
PDFException