Package eu.europa.esig.dss.model
Class CommonDocument
java.lang.Object
eu.europa.esig.dss.model.CommonDocument
- All Implemented Interfaces:
DSSDocument
,Serializable
- Direct Known Subclasses:
CMSSignedDocument
,DigestDocument
,FileDocument
,InMemoryDocument
public abstract class CommonDocument extends Object implements DSSDocument
This class implements the default methods.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected String
absolutePath
protected EnumMap<DigestAlgorithm,String>
base64EncodeDigestMap
protected MimeType
mimeType
protected String
name
-
Constructor Summary
Constructors Constructor Description CommonDocument()
-
Method Summary
Modifier and Type Method Description String
getAbsolutePath()
Returns theString
representing the absolute path to the encapsulated document.String
getDigest(DigestAlgorithm digestAlgorithm)
This method returns the encoded digest value of the currentDSSDocument
using the base64 algorithm.MimeType
getMimeType()
Returns the mime-type of theDSSDocument
.String
getName()
Returns the name of the document.void
save(String path)
Save the content of the DSSDocument to the file.void
setAbsolutePath(String absolutePath)
void
setMimeType(MimeType mimeType)
This method sets the mime-type of theDSSDocument
.void
setName(String name)
This method sets the name of theDSSDocument
.String
toString()
void
writeTo(OutputStream stream)
Writes the content of the document to the provided OutputStream
-
Field Details
-
Constructor Details
-
CommonDocument
public CommonDocument()
-
-
Method Details
-
save
Description copied from interface:DSSDocument
Save the content of the DSSDocument to the file.- Specified by:
save
in interfaceDSSDocument
- Parameters:
path
- the path to the file to be created- Throws:
IOException
- if any IO error happens
-
writeTo
Description copied from interface:DSSDocument
Writes the content of the document to the provided OutputStream- Specified by:
writeTo
in interfaceDSSDocument
- Parameters:
stream
- the output stream where to write- Throws:
IOException
- if any IO error happens
-
getMimeType
Description copied from interface:DSSDocument
Returns the mime-type of theDSSDocument
.- Specified by:
getMimeType
in interfaceDSSDocument
- Returns:
MimeType
-
setMimeType
Description copied from interface:DSSDocument
This method sets the mime-type of theDSSDocument
.- Specified by:
setMimeType
in interfaceDSSDocument
- Parameters:
mimeType
-MimeType
-
getName
Description copied from interface:DSSDocument
Returns the name of the document. If theDSSDocument
was built based on theFile
then the file name is returned.- Specified by:
getName
in interfaceDSSDocument
- Returns:
String
representing the name of the currentDSSDocument
-
setName
Description copied from interface:DSSDocument
This method sets the name of theDSSDocument
.- Specified by:
setName
in interfaceDSSDocument
- Parameters:
name
- the document name
-
getAbsolutePath
Description copied from interface:DSSDocument
Returns theString
representing the absolute path to the encapsulated document.- Specified by:
getAbsolutePath
in interfaceDSSDocument
- Returns:
String
representing the absolute path to the encapsulated document.
-
setAbsolutePath
-
getDigest
Description copied from interface:DSSDocument
This method returns the encoded digest value of the currentDSSDocument
using the base64 algorithm.- Specified by:
getDigest
in interfaceDSSDocument
- Parameters:
digestAlgorithm
-DigestAlgorithm
- Returns:
- base64 encoded
String
-
toString
-