Package net.solarnetwork.node.backup
Class ZipEntryBackupResource
java.lang.Object
net.solarnetwork.node.backup.ZipEntryBackupResource
- All Implemented Interfaces:
BackupResource
BackupResource for a file in a zip archive.- Version:
- 1.3
- Author:
- matt
-
Constructor Summary
ConstructorsConstructorDescriptionZipEntryBackupResource(ZipFile archiveFile, ZipEntry entry) Constructor.ZipEntryBackupResource(ZipFile archiveFile, ZipEntry entry, String providerKey) Construct with values. -
Method Summary
Modifier and TypeMethodDescriptionGet a relative path to save this resource to in the backup.Get anInputStreamto the resource.longGet the modification date of the resource, in milliseconds since the epoch.Get the key of theBackupResourceProviderthat provided this resource.Get the expected SHA-256 digest of the resource content.
-
Constructor Details
-
ZipEntryBackupResource
Constructor. TheproviderKeywill be set to null.- Parameters:
archiveFile- the archive fileentry- the entry previously obtained from the zip archive
-
ZipEntryBackupResource
Construct with values.- Parameters:
archiveFile- the archive fileentry- the entry previously obtained from the zip archiveproviderKey- the provider key- Since:
- 1.1
-
-
Method Details
-
getProviderKey
Description copied from interface:BackupResourceGet the key of theBackupResourceProviderthat provided this resource.- Specified by:
getProviderKeyin interfaceBackupResource- Returns:
- The provider key.
-
getBackupPath
Description copied from interface:BackupResourceGet 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:
getBackupPathin interfaceBackupResource- Returns:
- the relative path
-
getInputStream
Description copied from interface:BackupResourceGet anInputStreamto the resource.- Specified by:
getInputStreamin interfaceBackupResource- Returns:
- an InputStream to the data for the resource
- Throws:
IOException- if any IO error occurs
-
getModificationDate
public long getModificationDate()Description copied from interface:BackupResourceGet the modification date of the resource, in milliseconds since the epoch.- Specified by:
getModificationDatein interfaceBackupResource- Returns:
- the modification date, or -1 if not known
-
getSha256Digest
Description copied from interface:BackupResourceGet 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:
getSha256Digestin interfaceBackupResource- Returns:
- the SHA-256 digest as a hex-encoded string, or null if not known
-