Package nl.knaw.dans.bagit.reader
Class MetadataReader
java.lang.Object
nl.knaw.dans.bagit.reader.MetadataReader
This class is responsible for reading and parsing bagit metadata files from the filesystem
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private static final ResourceBundle
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<AbstractMap.SimpleImmutableEntry<String,
String>> readBagMetadata
(Path rootDir, Charset encoding) Reads the bag metadata file (bag-info.txt or package-info.txt) and returns it.
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
messages
-
-
Constructor Details
-
MetadataReader
private MetadataReader()
-
-
Method Details
-
readBagMetadata
public static List<AbstractMap.SimpleImmutableEntry<String,String>> readBagMetadata(Path rootDir, Charset encoding) throws IOException, InvalidBagMetadataException Reads the bag metadata file (bag-info.txt or package-info.txt) and returns it.- Parameters:
rootDir
- the root directory of the bagencoding
- the encoding of the bagit.txt file- Returns:
- the bag-info.txt (metadata) information
- Throws:
IOException
- if there is a problem reading a fileInvalidBagMetadataException
- if the metadata file does not conform to the bagit spec
-