public class Unpickler
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
HIGHEST_PROTOCOL
The highest Python Pickle protocol version supported by this library.
|
protected java.io.InputStream |
input
The stream where the pickle data is read from.
|
protected java.util.Map<java.lang.Integer,java.lang.Object> |
memo
Internal cache of memoized objects.
|
protected static java.lang.Object |
NO_RETURN_VALUE
Used as return value for
dispatch(short) in the general case (because the object graph is built on the stack) |
protected static java.util.Map<java.lang.String,IObjectConstructor> |
objectConstructors
Registry of object constructors that are used to create the appropriate Java objects for the given Python module.typename references.
|
protected UnpickleStack |
stack
The stack that is used for building the resulting object graph.
|
| Constructor and Description |
|---|
Unpickler()
Create an unpickler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the unpickler and frees the resources such as the unpickle stack and memo table.
|
protected java.lang.Object |
dispatch(short key)
Process a single pickle stream opcode.
|
java.lang.Object |
load(java.io.InputStream stream)
Read a pickled object representation from the given input stream.
|
java.lang.Object |
loads(byte[] pickledata)
Read a pickled object representation from the given pickle data bytes.
|
protected java.lang.Object |
next_buffer()
Buffer support for protocol 5 out of band data
If you want to unpickle such pickles, you'll have to subclass the unpickler
and override this method to return the buffer data you want.
|
protected java.lang.Object |
persistentLoad(java.lang.String pid)
Hook for the persistent id feature where an id is replaced externally by the appropriate object.
|
static void |
registerConstructor(java.lang.String module,
java.lang.String classname,
IObjectConstructor constructor)
Register additional object constructors for custom classes.
|
protected static final java.lang.Object NO_RETURN_VALUE
dispatch(short) in the general case (because the object graph is built on the stack)protected final int HIGHEST_PROTOCOL
protected java.util.Map<java.lang.Integer,java.lang.Object> memo
protected UnpickleStack stack
protected java.io.InputStream input
protected static java.util.Map<java.lang.String,IObjectConstructor> objectConstructors
public static void registerConstructor(java.lang.String module,
java.lang.String classname,
IObjectConstructor constructor)
public java.lang.Object load(java.io.InputStream stream)
throws PickleException,
java.io.IOException
PickleExceptionjava.io.IOExceptionpublic java.lang.Object loads(byte[] pickledata)
throws PickleException,
java.io.IOException
PickleExceptionjava.io.IOExceptionpublic void close()
protected java.lang.Object next_buffer()
throws PickleException,
java.io.IOException
PickleExceptionjava.io.IOExceptionprotected java.lang.Object dispatch(short key)
throws PickleException,
java.io.IOException
PickleExceptionjava.io.IOExceptionprotected java.lang.Object persistentLoad(java.lang.String pid)
pid - the persistent id from the pickleCopyright © 2019. All Rights Reserved.