Class Bag
- java.lang.Object
-
- uk.org.esciencelab.researchobjectservice.serialization.Bag
-
public class Bag extends java.lang.ObjectA class to construct BagIt bags.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddData(java.lang.String filename, byte[] bytes)Write bytes to a file to the bag.voidaddRemote(RemoteResource entry)Add a remote file to the bag.java.nio.file.PathgetDataFolder()java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>>getEmptyChecksumMap()java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>>getFileChecksums()java.util.List<java.io.File>getFiles()java.nio.file.PathgetLocation()java.lang.StringgetPayloadOxum()java.util.List<RemoteResource>getRemoteItems()java.lang.String[]getSupportedAlgorithms()
-
-
-
Constructor Detail
-
Bag
public Bag(java.nio.file.Path location)
- Parameters:
location- The location where to put the bag-in-progress (can be a temp directory!).
-
Bag
public Bag(java.nio.file.Path location, java.lang.String[] checksumAlgorithms)- Parameters:
location- The location where to put the bag-in-progress.checksumAlgorithms- An array of checksum algorithm names to use in the manifest and tagmanifest files.
-
-
Method Detail
-
addData
public void addData(java.lang.String filename, byte[] bytes) throws java.security.NoSuchAlgorithmException, java.io.IOExceptionWrite bytes to a file to the bag.- Parameters:
filename- The file name to write to, under data/.bytes- The bytes of the file to write.- Throws:
java.security.NoSuchAlgorithmExceptionjava.io.IOException
-
addRemote
public void addRemote(RemoteResource entry)
Add a remote file to the bag.- Parameters:
entry- The remote file to add, as a RemoteResource object.
-
getLocation
public java.nio.file.Path getLocation()
-
getSupportedAlgorithms
public java.lang.String[] getSupportedAlgorithms()
-
getRemoteItems
public java.util.List<RemoteResource> getRemoteItems()
-
getFiles
public java.util.List<java.io.File> getFiles()
-
getFileChecksums
public java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>> getFileChecksums()
-
getPayloadOxum
public java.lang.String getPayloadOxum()
-
getDataFolder
public java.nio.file.Path getDataFolder() throws java.io.IOException- Throws:
java.io.IOException
-
getEmptyChecksumMap
public java.util.Map<java.lang.String,java.util.Map<java.nio.file.Path,java.lang.String>> getEmptyChecksumMap()
-
-