Class InventoryMapper
- java.lang.Object
-
- edu.wisc.library.ocfl.core.inventory.InventoryMapper
-
public class InventoryMapper extends Object
Wrapper around Jackson's ObjectMapper for serializing and deserializing Inventories. The ObjectMapper setup is a finicky and I do not recommend changing it unless you are sure you know what you're doing.
-
-
Constructor Summary
Constructors Constructor Description InventoryMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)Should use InventoryMapper.defaultMapper() or InventoryMapper.prettyPrintMapper() unless you know what you're doing.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InventoryMapperdefaultMapper()Creates an InventoryMapper that creates JSON files with as little whitespace as possible.static InventoryMapperprettyPrintMapper()Creates an InventoryMapper that will pretty print JSON files.Inventoryread(String objectRootPath, DigestAlgorithm digestAlgorithm, InputStream inputStream)Inventoryread(String objectRootPath, DigestAlgorithm digestAlgorithm, Path path)InventoryreadMutableHead(String objectRootPath, RevisionNum revisionNum, DigestAlgorithm digestAlgorithm, InputStream inputStream)InventoryreadMutableHead(String objectRootPath, RevisionNum revisionNum, DigestAlgorithm digestAlgorithm, Path path)InventoryreadMutableHeadNoDigest(String objectRootPath, RevisionNum revisionNum, InputStream inputStream)InventoryreadMutableHeadNoDigest(String objectRootPath, RevisionNum revisionNum, Path path)InventoryreadNoDigest(String objectRootPath, InputStream inputStream)InventoryreadNoDigest(String objectRootPath, Path path)voidwrite(OutputStream outputStream, Inventory inventory)voidwrite(Path destination, Inventory inventory)
-
-
-
Method Detail
-
prettyPrintMapper
public static InventoryMapper prettyPrintMapper()
Creates an InventoryMapper that will pretty print JSON files. This should be used when you value human readability over disk space usage.- Returns:
- mapper
-
defaultMapper
public static InventoryMapper defaultMapper()
Creates an InventoryMapper that creates JSON files with as little whitespace as possible. This should be used when minimizing disk space usage is more important than human readability.- Returns:
- mapper
-
write
public void write(OutputStream outputStream, Inventory inventory)
-
read
public Inventory read(String objectRootPath, DigestAlgorithm digestAlgorithm, Path path)
-
read
public Inventory read(String objectRootPath, DigestAlgorithm digestAlgorithm, InputStream inputStream)
-
readMutableHead
public Inventory readMutableHead(String objectRootPath, RevisionNum revisionNum, DigestAlgorithm digestAlgorithm, Path path)
-
readMutableHead
public Inventory readMutableHead(String objectRootPath, RevisionNum revisionNum, DigestAlgorithm digestAlgorithm, InputStream inputStream)
-
readNoDigest
public Inventory readNoDigest(String objectRootPath, InputStream inputStream)
-
readMutableHeadNoDigest
public Inventory readMutableHeadNoDigest(String objectRootPath, RevisionNum revisionNum, Path path)
-
readMutableHeadNoDigest
public Inventory readMutableHeadNoDigest(String objectRootPath, RevisionNum revisionNum, InputStream inputStream)
-
-