Class ZipEntryBackupResource

java.lang.Object
net.solarnetwork.node.backup.ZipEntryBackupResource
All Implemented Interfaces:
BackupResource

public class ZipEntryBackupResource extends Object implements BackupResource
BackupResource for a file in a zip archive.
Version:
1.3
Author:
matt
  • Constructor Details

    • ZipEntryBackupResource

      public ZipEntryBackupResource(ZipFile archiveFile, ZipEntry entry)
      Constructor. The providerKey will be set to null.
      Parameters:
      archiveFile - the archive file
      entry - the entry previously obtained from the zip archive
    • ZipEntryBackupResource

      public ZipEntryBackupResource(ZipFile archiveFile, ZipEntry entry, String providerKey)
      Construct with values.
      Parameters:
      archiveFile - the archive file
      entry - the entry previously obtained from the zip archive
      providerKey - the provider key
      Since:
      1.1
  • Method Details

    • getProviderKey

      public String getProviderKey()
      Description copied from interface: BackupResource
      Get the key of the BackupResourceProvider that provided this resource.
      Specified by:
      getProviderKey in interface BackupResource
      Returns:
      The provider key.
    • getBackupPath

      public String getBackupPath()
      Description copied from interface: BackupResource
      Get a relative path to save this resource to in the backup.

      This must be a URL-like path, using a forward slash to represent directories. For example, the a path could be some/path/here.txt.

      Specified by:
      getBackupPath in interface BackupResource
      Returns:
      the relative path
    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: BackupResource
      Get an InputStream to the resource.
      Specified by:
      getInputStream in interface BackupResource
      Returns:
      an InputStream to the data for the resource
      Throws:
      IOException - if any IO error occurs
    • getModificationDate

      public long getModificationDate()
      Description copied from interface: BackupResource
      Get the modification date of the resource, in milliseconds since the epoch.
      Specified by:
      getModificationDate in interface BackupResource
      Returns:
      the modification date, or -1 if not known
    • getSha256Digest

      public String getSha256Digest()
      Description copied from interface: BackupResource
      Get the expected SHA-256 digest of the resource content.

      This value is meant to be used to verify the integrity of the content of the resource when read from BackupResource.getInputStream().

      Specified by:
      getSha256Digest in interface BackupResource
      Returns:
      the SHA-256 digest as a hex-encoded string, or null if not known