Package nl.knaw.dans.bagit.writer
Class BagWriter
java.lang.Object
nl.knaw.dans.bagit.writer.BagWriter
responsible for writing out a
Bag
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private static final ResourceBundle
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionupdateTagManifests
(Bag bag, Path newBagRootDir) static void
Write the bag out to the specified directory.private static void
writeTagManifestFiles
(Set<Manifest> manifests, Path outputDir, Path bagRootDir)
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
messages
-
-
Constructor Details
-
BagWriter
private BagWriter()
-
-
Method Details
-
write
Write the bag out to the specified directory. If an error occurs some of the files may have been written out to the filesystem. tag manifest(s) are updated prior to writing to ensure bag is valid after completion, it is therefore recommended if you are going to further interact with the bag to read it from specified outputDir path- Parameters:
bag
- theBag
object to write outoutputDir
- the output directory that will become the root of the bag- Throws:
IOException
- if there is a problem writing a fileNoSuchAlgorithmException
- when trying to generate aMessageDigest
which is used during update.
-
updateTagManifests
private static Set<Manifest> updateTagManifests(Bag bag, Path newBagRootDir) throws NoSuchAlgorithmException, IOException - Throws:
NoSuchAlgorithmException
IOException
-
writeTagManifestFiles
private static void writeTagManifestFiles(Set<Manifest> manifests, Path outputDir, Path bagRootDir) throws IOException - Throws:
IOException
-