Class Bag


  • public class Bag
    extends java.lang.Object
    A class to construct BagIt bags.
    • Constructor Summary

      Constructors 
      Constructor Description
      Bag​(java.nio.file.Path location)  
      Bag​(java.nio.file.Path location, java.lang.String[] checksumAlgorithms)  
    • 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.IOException
        Write 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.NoSuchAlgorithmException
        java.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()