public class Pickler extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Pickler.Memo |
| Modifier and Type | Field and Description |
|---|---|
protected static Map<Class<?>,IObjectPickler> |
customPicklers |
static int |
HIGHEST_PROTOCOL |
protected static int |
MAX_RECURSE_DEPTH |
protected HashMap<Integer,Pickler.Memo> |
memo |
protected OutputStream |
out |
protected int |
PROTOCOL |
protected int |
recurse |
protected boolean |
useMemo |
| Constructor and Description |
|---|
Pickler()
Create a Pickler.
|
Pickler(boolean useMemo)
Create a Pickler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the pickler stream, discard any internal buffers.
|
void |
dump(Object o,
OutputStream stream)
Pickle a given object graph, writing the result to the output stream.
|
byte[] |
dumps(Object o)
Pickle a given object graph, returning the result as a byte array.
|
protected IObjectPickler |
getCustomPickler(Class<?> t) |
static void |
registerCustomPickler(Class<?> clazz,
IObjectPickler pickler)
Register additional object picklers for custom classes.
|
void |
save(Object o)
Pickle a single object and write its pickle representation to the output stream.
|
protected void |
writeMemo(Object obj)
Write the object to the memo table and output a memo write opcode
Only works for hashable objects
|
public static int HIGHEST_PROTOCOL
protected static int MAX_RECURSE_DEPTH
protected int recurse
protected OutputStream out
protected int PROTOCOL
protected static Map<Class<?>,IObjectPickler> customPicklers
protected boolean useMemo
protected HashMap<Integer,Pickler.Memo> memo
public Pickler()
public Pickler(boolean useMemo)
public void close()
throws IOException
IOExceptionpublic static void registerCustomPickler(Class<?> clazz, IObjectPickler pickler)
public byte[] dumps(Object o) throws PickleException, IOException
PickleExceptionIOExceptionpublic void dump(Object o, OutputStream stream) throws IOException, PickleException
IOExceptionPickleExceptionpublic void save(Object o) throws PickleException, IOException
PickleExceptionIOExceptionprotected void writeMemo(Object obj) throws IOException
IOExceptionprotected IObjectPickler getCustomPickler(Class<?> t)
Copyright © 2016. All Rights Reserved.