public interface EDOC
An instance of EDOC class can be obtained using the EDOCBuilder class.
| Modifier and Type | Method and Description |
|---|---|
EDOCDataFile |
addFile(File file)
Adds a new file to the existing EDOC data file list.
|
EDOCDataFile |
addFile(String pathname)
Adds a new file to the existing EDOC data file list.
|
EDOCDataFile |
addFile(String name,
byte[] data,
String contentType)
Adds a new file to the existing EDOC data file list.
|
EDOCDataFile |
addFile(URL url)
Adds a new file to the existing EDOC data file list.
|
EDOCSignature |
addSignature(EDOCSignatureContext edocSignatureContext)
Adds a new signature to the existing EDOC signature list.
|
EDOCSignature |
addSignature(KeyAccessor keyAccessor,
EDOCSignatureCallback edocSignatureCallback)
Adds a new signature to the existing EDOC signature list.
|
void |
close()
Closes this EDOC file and releases associated system resources.
|
boolean |
containsFile(String name)
Returns true if a file with the specified name is contained by this EDOC.
|
EDOCProperties |
getBaseProperties()
Returns EDOC base properties.
|
EDOCProperties |
getCoreProperties()
Returns EDOC core properties.
|
EDOCProperties |
getExtendedProperties()
Returns EDOC extended properties.
|
EDOCDataFile |
getFile(String name)
Returns the data file by the specified name.
|
int |
getFileCount()
Returns the number of files in this EDOC.
|
EDOCDataFile[] |
getFiles()
Returns an array of data files in this EDOC.
|
String |
getName()
Returns the name of this EDOC file.
|
EDOCSignature |
getSignature(String id)
Returns the signature by the specified id.
|
int |
getSignatureCount()
Returns the number of signatures in this EDOC.
|
EDOCSignature[] |
getSignatures()
Returns an array of signatures in this EDOC.
|
EDOCTemplate |
getTemplate()
Returns the template used to create this EDOC file.
|
EDOCPreparedSignature |
prepareSignature(SignatureType signatureType,
X509Certificate certificate)
Prepares a new signature for this EDOC instance.
|
void |
removeFile(String name)
Removes EDOCDataFile object from the existing EDOC data file list.
|
void |
removeSignature(String id)
Removes EDOCSignature object from the existing EDOC signature list.
|
void |
saveTo(File file)
Saves this EDOC file to the given file.
|
void |
saveTo(File file,
int zipCompressionLevel)
Saves this EDOC file to the given file using the given ZIP compression level.
|
void |
saveTo(OutputStream outputStream)
Saves this EDOC file to the given output stream.
|
void |
saveTo(OutputStream outputStream,
int zipCompressionLevel)
Saves this EDOC file to the given output stream using the given ZIP compression level.
|
EDOCValidatorResult |
validate(EDOCValidatorListener listener)
Validates this EDOC document.
|
int getFileCount()
EDOCDataFile[] getFiles()
EDOCDataFile getFile(String name) throws EDOCException
name - the name of EDOCDataFile to be returned.EDOCException - if file with the specified name does not exist.boolean containsFile(String name)
name - the name of EDOCDataFile to be checked.EDOCDataFile addFile(String pathname) throws EDOCException
pathname - an abstract pathname denoting the file to add.EDOCException - if file with the same name is already added,
EDOC alrady contains EDOCSignature,
or file by the specified pathname cannot be read.EDOCDataFile addFile(File file) throws EDOCException
file - a File object denoting the file to add.EDOCException - if file with the same name is already added,
EDOC alrady contains EDOCSignature,
or the specified File cannot be read.EDOCDataFile addFile(URL url) throws EDOCException
url - an URL object representing the file to add.EDOCException - if file with the same name is already added,
EDOC alrady contains EDOCSignature,
or file from the specified URL cannot be read.EDOCDataFile addFile(String name, byte[] data, String contentType) throws EDOCException
name - name of the file to add.data - byte array representing the file to add.contentType - the content type of the file to add.EDOCException - if file with the same name is already added,
or EDOC alrady contains EDOCSignature.void removeFile(String name) throws EDOCException
name - the name of EDOCDataFile to be removed.EDOCException - if data file cannot be deleted,
or EDOC alrady contains EDOCSignature.int getSignatureCount()
EDOCSignature[] getSignatures()
EDOCSignature getSignature(String id) throws EDOCException
id - the id of EDOCSignature to be returned.EDOCException - if signature with the specified id does not exist.EDOCSignature addSignature(KeyAccessor keyAccessor, EDOCSignatureCallback edocSignatureCallback) throws EDOCException
A KeyAccessor is used to access the document signing certificate.
Optionally a client authentication certificate can be required
when requesting a timestamp from the timestamping authority (TSA).
While creating the signature a communication with the user is required,
therefore you must specify an instance of EDOCSignatureCallback object
which implements the required callback methods.
keyAccessor - a KeyAccessor instance used to access cryptographic keys and certificates.edocSignatureCallback - callback object used to get user input.EDOCException - if signature cannot be created.EDOCSignature addSignature(EDOCSignatureContext edocSignatureContext) throws EDOCException
edocSignatureContext - EDOC signature context.EDOCException - if signature cannot be created.EDOCPreparedSignature prepareSignature(SignatureType signatureType, X509Certificate certificate) throws EDOCException
The signature value for EDOCPreparedSignature is not calculated automatically
and must be provided using the EDOCPreparedSignature.setSignatureValue(byte[]) method.
In order to add another signature or save the EDOC document,
the current EDOCPreparedSignature must be completed using the EDOCPreparedSignature.complete() method.
signatureType - the desired signature type.
The signature level must be specified using the SignatureType.setSignatureLevel(int) method.
certificate - the document signing certificate.EDOCException - if signature cannot be prepared.void removeSignature(String id) throws EDOCException
id - the id of EDOCSignature to be removed.EDOCException - if signature cannot be removed.EDOCProperties getCoreProperties()
EDOCProperties getBaseProperties()
EDOCProperties getExtendedProperties()
EDOCTemplate getTemplate()
String getName()
void saveTo(File file) throws EDOCException
file - a file where this EDOC file should be saved.EDOCException - if this EDOC file cannot be saved.void saveTo(File file, int zipCompressionLevel) throws EDOCException
file - a file where this EDOC file should be saved.zipCompressionLevel - the ZIP compression level (0-9).EDOCException - if this EDOC file cannot be saved.void saveTo(OutputStream outputStream) throws EDOCException
outputStream - an output stream where this EDOC file should be saved.EDOCException - if this EDOC file cannot be saved.void saveTo(OutputStream outputStream, int zipCompressionLevel) throws EDOCException
outputStream - an output stream where this EDOC file should be saved.zipCompressionLevel - the ZIP compression level (0-9).EDOCException - if this EDOC file cannot be saved.EDOCValidatorResult validate(EDOCValidatorListener listener) throws EDOCException
To notify the user about the validation process, validation status events are generated.
To get these notifications, an application must specify an instance
of EDOCValidatorListener object which implements the required listener methods.
listener - the EDOCValidatorListener to be notified.EDOCException - if EDOC validation cannot be performed.void close()
throws EDOCException
EDOCException - if associated system resources cannot be released.