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 Details

    • base64EncodeDigestMap

      protected EnumMap<DigestAlgorithm,​String> base64EncodeDigestMap
      Cached map of DigestAlgorithms and the corresponding digests for the document
    • mimeType

      protected MimeType mimeType
      The MimeType of the document
    • name

      protected String name
      The document name
    • absolutePath

      protected String absolutePath
      The document's absolute path
  • Constructor Details

    • CommonDocument

      public CommonDocument()
  • Method Details

    • save

      public void save​(String path) throws IOException
      Description copied from interface: DSSDocument
      Save the content of the DSSDocument to the file.
      Specified by:
      save in interface DSSDocument
      Parameters:
      path - the path to the file to be created
      Throws:
      IOException - if any IO error happens
    • writeTo

      public void writeTo​(OutputStream stream) throws IOException
      Description copied from interface: DSSDocument
      Writes the content of the document to the provided OutputStream
      Specified by:
      writeTo in interface DSSDocument
      Parameters:
      stream - the output stream where to write
      Throws:
      IOException - if any IO error happens
    • getMimeType

      public MimeType getMimeType()
      Description copied from interface: DSSDocument
      Returns the mime-type of the DSSDocument.
      Specified by:
      getMimeType in interface DSSDocument
      Returns:
      MimeType
    • setMimeType

      public void setMimeType​(MimeType mimeType)
      Description copied from interface: DSSDocument
      This method sets the mime-type of the DSSDocument.
      Specified by:
      setMimeType in interface DSSDocument
      Parameters:
      mimeType - MimeType
    • getName

      public String getName()
      Description copied from interface: DSSDocument
      Returns the name of the document. If the DSSDocument was built based on the File then the file name is returned.
      Specified by:
      getName in interface DSSDocument
      Returns:
      String representing the name of the current DSSDocument
    • setName

      public void setName​(String name)
      Description copied from interface: DSSDocument
      This method sets the name of the DSSDocument.
      Specified by:
      setName in interface DSSDocument
      Parameters:
      name - the document name
    • getAbsolutePath

      public String getAbsolutePath()
      Description copied from interface: DSSDocument
      Returns the String representing the absolute path to the encapsulated document.
      Specified by:
      getAbsolutePath in interface DSSDocument
      Returns:
      String representing the absolute path to the encapsulated document.
    • setAbsolutePath

      public void setAbsolutePath​(String absolutePath)
    • getDigest

      public String getDigest​(DigestAlgorithm digestAlgorithm)
      Description copied from interface: DSSDocument
      This method returns the encoded digest value of the current DSSDocument using the base64 algorithm.
      Specified by:
      getDigest in interface DSSDocument
      Parameters:
      digestAlgorithm - DigestAlgorithm
      Returns:
      base64 encoded String
    • toString

      public String toString()
      Overrides:
      toString in class Object