Package no.difi.asic

Interface AsicWriter

All Known Implementing Classes:
CmsEncryptedAsicWriter

public interface AsicWriter
  • Method Summary

    Modifier and Type
    Method
    Description
    add(File file)
    Adds another data object to the ASiC archive.
    add(File file, String entryName)
    Adds another data object to the ASiC container, using the supplied name as the zip entry name
    add(File file, String entryName, MimeType mimeType)
    Adds the contents of a file into the ASiC archive using the supplied entry name and MIME type.
    add(InputStream inputStream, String filename)
    Adds the data provided by the stream into the ASiC archive, using the name of the supplied file as the entry name.
    add(InputStream inputStream, String filename, MimeType mimeType)
    Adds the contents of an input stream into the ASiC archive, under a given entry name and explicitly identifying the MIME type.
    add(Path path)
    Adds another data object to the ASiC archive
    add(Path path, String entryName)
    Adds another data object to the ASiC container under the entry name provided.
    add(Path path, String entryName, MimeType mimeType)
     
    Specifies which entry (file) represents the "root" document, i.e. which business document to read first.
    sign(File keyStoreFile, String keyStorePassword, String keyPassword)
    Signs and closes the ASiC archive.
    sign(File keyStoreFile, String keyStorePassword, String keyAlias, String keyPassword)
    Signs and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.
    sign(File keyStoreFile, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword)
    Signs and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.
    sign(SignatureHelper signatureHelper)
    Allows re-use of the same SignatureHelper object when creating multiple ASiC archive and hence the need to create multiple signatures.
  • Method Details

    • add

      AsicWriter add(File file) throws IOException
      Adds another data object to the ASiC archive.
      Parameters:
      file - references the file to be added as a data object. The name of the entry is extracted from the File object.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
    • add

      AsicWriter add(File file, String entryName) throws IOException
      Adds another data object to the ASiC container, using the supplied name as the zip entry name
      Parameters:
      file - references the file to be added as a data object.
      entryName - the archive entry name to be used.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
    • add

      AsicWriter add(Path path) throws IOException
      Adds another data object to the ASiC archive
      Parameters:
      path - references the file to be added.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
      See Also:
    • add

      AsicWriter add(Path path, String entryName) throws IOException
      Adds another data object to the ASiC container under the entry name provided.
      Parameters:
      path - reference to this AsicWriter.
      entryName - the archive entry name to be used.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
      See Also:
    • add

      AsicWriter add(InputStream inputStream, String filename) throws IOException
      Adds the data provided by the stream into the ASiC archive, using the name of the supplied file as the entry name.
      Parameters:
      inputStream - input stream of data.
      filename - the name of a file, which must be available in the file system in order to determine the MIME type.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
    • add

      AsicWriter add(File file, String entryName, MimeType mimeType) throws IOException
      Adds the contents of a file into the ASiC archive using the supplied entry name and MIME type.
      Parameters:
      file - references the file to be added as a data object.
      entryName - the archive entry name to be used.
      mimeType - explicitly identifies the MIME type of the entry.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
    • add

      AsicWriter add(Path path, String entryName, MimeType mimeType) throws IOException
      Throws:
      IOException
      See Also:
    • add

      AsicWriter add(InputStream inputStream, String filename, MimeType mimeType) throws IOException
      Adds the contents of an input stream into the ASiC archive, under a given entry name and explicitly identifying the MIME type.
      Throws:
      IOException
      See Also:
    • setRootEntryName

      AsicWriter setRootEntryName(String name)
      Specifies which entry (file) represents the "root" document, i.e. which business document to read first.
      Parameters:
      name - of entry holding the root document.
      Returns:
      reference to this AsicWriter
    • sign

      AsicWriter sign(File keyStoreFile, String keyStorePassword, String keyPassword) throws IOException
      Signs and closes the ASiC archive. The private and public key is obtained from the supplied key store.
      Parameters:
      keyStoreFile - the file holding the JKS keystore file.
      keyStorePassword - password for the keystore
      keyPassword - password protecting the private key.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
    • sign

      AsicWriter sign(File keyStoreFile, String keyStorePassword, String keyAlias, String keyPassword) throws IOException
      Signs and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.
      Parameters:
      keyStoreFile - the file holding the JKS keystore file.
      keyStorePassword - password for the keystore
      keyAlias - the alias of the keystore entry holding the private and the public key.
      keyPassword - password protecting the private key.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
    • sign

      AsicWriter sign(File keyStoreFile, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword) throws IOException
      Signs and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.
      Parameters:
      keyStoreFile - the file holding the keystore file.
      keyStorePassword - password for the keystore
      keyStoreType - Type of keyStore
      keyAlias - the alias of the keystore entry holding the private and the public key.
      keyPassword - password protecting the private key.
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
    • sign

      AsicWriter sign(SignatureHelper signatureHelper) throws IOException
      Allows re-use of the same SignatureHelper object when creating multiple ASiC archive and hence the need to create multiple signatures.
      Parameters:
      signatureHelper - instantiated SignatureHelper
      Returns:
      reference to this AsicWriter
      Throws:
      IOException
      See Also: