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, String digest, InputStream inputStream)Inventoryread(String objectRootPath, String digest, Path path)InventoryreadMutableHead(String objectRootPath, String digest, RevisionNum revisionNum, InputStream inputStream)InventoryreadMutableHead(String objectRootPath, String digest, RevisionNum revisionNum, 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, String digest, InputStream inputStream)
-
readMutableHead
public Inventory readMutableHead(String objectRootPath, String digest, RevisionNum revisionNum, Path path)
-
readMutableHead
public Inventory readMutableHead(String objectRootPath, String digest, RevisionNum revisionNum, InputStream inputStream)
-
-