T
- the type of object serialized into the zip entrypublic class ZipEntryBackedObject<T extends Serializable> extends Object implements PersistenceBackedObject<T>
Constructor and Description |
---|
ZipEntryBackedObject(ZipFile zipFile,
String libraryPath,
String resourcePath,
Class<T> clazz)
Constructs a read-only instance that will dynamically open the provided resourcePath in the
provided zipFile when requested.
|
ZipEntryBackedObject(ZipOutputStream zipOutputStream,
String libraryPath,
String resourcePath,
Class<T> clazz)
Constructs a write-only instance that will write a ZipEntry and bytes to the provided
zipOutputStream when requested.
Cannot be used to overwrite an already existing entry. |
Modifier and Type | Method and Description |
---|---|
boolean |
exists()
Returns whether the intended persistence location is already populated.
|
String |
getPath()
Returns the path to the intended persistence location.
|
T |
newInstance(TreeLogger logger)
Constructs and returns a new instance of the object stored at the path.
|
void |
set(TreeLogger logger,
T object)
Serializes the provided object to the intended path.
|
public ZipEntryBackedObject(ZipFile zipFile, String libraryPath, String resourcePath, Class<T> clazz)
public ZipEntryBackedObject(ZipOutputStream zipOutputStream, String libraryPath, String resourcePath, Class<T> clazz)
public boolean exists()
PersistenceBackedObject
exists
in interface PersistenceBackedObject<T extends Serializable>
public String getPath()
PersistenceBackedObject
getPath
in interface PersistenceBackedObject<T extends Serializable>
public T newInstance(TreeLogger logger) throws UnableToCompleteException
PersistenceBackedObject
newInstance
in interface PersistenceBackedObject<T extends Serializable>
UnableToCompleteException
- if the backing store does not contain an object of type
T
public void set(TreeLogger logger, T object) throws IllegalStateException, UnableToCompleteException
PersistenceBackedObject
set
in interface PersistenceBackedObject<T extends Serializable>
UnableToCompleteException
- if the object could not be serializedIllegalStateException
Copyright © 2018. All rights reserved.