Class CommonDocument

java.lang.Object
eu.europa.esig.dss.model.CommonDocument
All Implemented Interfaces:
DSSDocument, Serializable
Direct Known Subclasses:
DigestDocument, FileDocument, InMemoryDocument

public abstract class CommonDocument extends Object implements DSSDocument
This class implements the default methods.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected EnumMap<eu.europa.esig.dss.enumerations.DigestAlgorithm,byte[]>
    Cached map of DigestAlgorithms and the corresponding digests for the document
    protected eu.europa.esig.dss.enumerations.MimeType
    The MimeType of the document
    protected String
    The document name
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor instantiating object with null values and empty digest map
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    getDigest(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
    This method returns the digest value of the current DSSDocument using the base64 algorithm.
    byte[]
    getDigestValue(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
    This method returns digest value of the current document's content using the provided digestAlgorithm
    eu.europa.esig.dss.enumerations.MimeType
    Returns the mime-type of the DSSDocument.
    Returns the name of the document.
    int
     
    void
    save(String path)
    Save the content of the DSSDocument to the file.
    void
    setMimeType(eu.europa.esig.dss.enumerations.MimeType mimeType)
    This method sets the mime-type of the DSSDocument.
    void
    This method sets the name of the DSSDocument.
     
    void
    Writes the content of the document to the provided OutputStream

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface eu.europa.esig.dss.model.DSSDocument

    openStream
  • Field Details

    • digestMap

      protected EnumMap<eu.europa.esig.dss.enumerations.DigestAlgorithm,byte[]> digestMap
      Cached map of DigestAlgorithms and the corresponding digests for the document
    • mimeType

      protected eu.europa.esig.dss.enumerations.MimeType mimeType
      The MimeType of the document
    • name

      protected String name
      The document name
  • Constructor Details

    • CommonDocument

      protected CommonDocument()
      Default constructor instantiating object with null values and empty digest map
  • 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 eu.europa.esig.dss.enumerations.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(eu.europa.esig.dss.enumerations.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
    • getDigest

      public Digest getDigest(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Description copied from interface: DSSDocument
      This method returns the digest value of the current DSSDocument using the base64 algorithm.
      Specified by:
      getDigest in interface DSSDocument
      Parameters:
      digestAlgorithm - DigestAlgorithm
      Returns:
      Digest
    • getDigestValue

      public byte[] getDigestValue(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Description copied from interface: DSSDocument
      This method returns digest value of the current document's content using the provided digestAlgorithm
      Specified by:
      getDigestValue in interface DSSDocument
      Parameters:
      digestAlgorithm - DigestAlgorithm to get digest for
      Returns:
      byte array representing digest of the document
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object