Package nl.knaw.dans.layerstore
Class TarArchive
java.lang.Object
nl.knaw.dans.layerstore.TarArchive
- All Implemented Interfaces:
Archive
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
archiveFrom
(Path stagingDir) Archives the given staging directory overwriting the backing file, if it exists.boolean
fileExists
(String filePath) Returns whether the file exists in the archive.boolean
Returns whether the archive has been created.Returns an input stream for the file at the given path.void
unarchiveTo
(Path stagingDir) Unarchives the archive to the given staging directory.
-
Constructor Details
-
TarArchive
-
-
Method Details
-
readFile
Description copied from interface:Archive
Returns an input stream for the file at the given path. The caller is responsible for closing the stream.- Specified by:
readFile
in interfaceArchive
- Parameters:
filePath
- the path of the file to read- Returns:
- the input stream
- Throws:
IOException
- if an I/O error occurs
-
unarchiveTo
Description copied from interface:Archive
Unarchives the archive to the given staging directory. Note that theArchive.isArchived()
will not returnfalse
after this operation, as the archive file is not removed.- Specified by:
unarchiveTo
in interfaceArchive
- Parameters:
stagingDir
- the directory to unarchive to
-
archiveFrom
Description copied from interface:Archive
Archives the given staging directory overwriting the backing file, if it exists. If this the archive is created successfully,Archive.isArchived()
will returntrue
.- Specified by:
archiveFrom
in interfaceArchive
- Parameters:
stagingDir
- the directory to archive
-
isArchived
public boolean isArchived()Description copied from interface:Archive
Returns whether the archive has been created.- Specified by:
isArchived
in interfaceArchive
- Returns:
- whether the archive has been created.
-
fileExists
Description copied from interface:Archive
Returns whether the file exists in the archive.- Specified by:
fileExists
in interfaceArchive
- Parameters:
filePath
- the path of the file to check- Returns:
- whether the file exists
-