com.qoppa.pdf
Class PDFPassword

java.lang.Object
  extended by com.qoppa.pdf.PDFPassword
All Implemented Interfaces:
IPassword

public class PDFPassword
extends Object
implements IPassword

Implementation of the IPassword interface that can hold either a single password or a list of passwords. In most cases, the host application should use this class to provide passwords to the library when opening encrypted documents.

Author:
Qoppa Software

Constructor Summary
PDFPassword(String password)
          Create an instance of the class that will hold a single fixed password.
PDFPassword(String[] pwdList)
          Create an instance of the class that will hold a list of possible passwords.
 
Method Summary
 String[] getPasswords()
          Method that fulfills the IPassword interface.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFPassword

public PDFPassword(String password)
Create an instance of the class that will hold a single fixed password.

Parameters:
password - The password to use when opening encrypted documents.

PDFPassword

public PDFPassword(String[] pwdList)
Create an instance of the class that will hold a list of possible passwords. The library will try each password in the list until one of them opens the document properly.

Parameters:
pwdList - The list of possible passwords.
Method Detail

getPasswords

public String[] getPasswords()
Method that fulfills the IPassword interface. The method returns the list of passwords stored in the object. When the constructor with the single String is used to create an instance of this class, the list returned consists of a single entry.

Specified by:
getPasswords in interface IPassword
Returns:
A list of passwords to try to open the document.