Class BagWriter
- java.lang.Object
-
- uk.org.esciencelab.researchobjectservice.serialization.BagWriter
-
- Direct Known Subclasses:
BagItROCrateWriter
,BagItROWriter
public class BagWriter extends java.lang.Object
A class for writing all necessary tag files etc. for a given Bag as a plain BagIt bag.
-
-
Field Summary
Fields Modifier and Type Field Description protected Bag
bag
protected java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>>
tagFileChecksums
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
updateChecksumMap(java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>> checksumMap, StreamWithDigests stream, java.nio.file.Path path)
void
write()
Write the bag!protected void
writeBagInfo()
protected void
writeBagIt()
protected void
writeFetch()
protected void
writeManifest(java.lang.String algorithm)
protected void
writeTagFiles()
protected void
writeTagManifest(java.lang.String algorithm)
-
-
-
Field Detail
-
bag
protected Bag bag
-
tagFileChecksums
protected java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>> tagFileChecksums
-
-
Constructor Detail
-
BagWriter
public BagWriter(Bag bag)
Create a new BagIt writer for the given bag.- Parameters:
bag
- The bag to write.
-
-
Method Detail
-
write
public void write() throws java.io.IOException, java.security.NoSuchAlgorithmException
Write the bag!- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
writeTagFiles
protected void writeTagFiles() throws java.io.IOException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
writeFetch
protected void writeFetch() throws java.io.IOException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
writeBagIt
protected void writeBagIt() throws java.io.IOException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
writeBagInfo
protected void writeBagInfo() throws java.io.IOException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
writeManifest
protected void writeManifest(java.lang.String algorithm) throws java.io.IOException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
writeTagManifest
protected void writeTagManifest(java.lang.String algorithm) throws java.io.IOException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
updateChecksumMap
protected void updateChecksumMap(java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>> checksumMap, StreamWithDigests stream, java.nio.file.Path path)
-
-