Package org.jmol.adapter.readers.pymol
Class PickleReader
- java.lang.Object
-
- org.jmol.adapter.readers.pymol.PickleReader
-
class PickleReader extends java.lang.Object
generic Python Pickle file reader only utilizing records needed for PyMOL. It appears we must read integers littleEndian and doubles bigEndian. 2013.04.06 -- added memo functions. PyMOL pickling is using LONG_BINPUT way too often. This results in a huge unnecessary memory overhead. My only solution is to only cache Strings in memo, and then only selectively -- not parts of movie; not when markCount > 5 (residues). This seems to work, but it is still way overkill, since each atom generates several items. see http://www.picklingtools.com/- Author:
- Bob Hanson hansonr@stolaf.edu
-
-
Field Summary
Fields Modifier and Type Field Description private static byte
APPEND
private static byte
APPENDS
(package private) byte[]
aTemp
private javajs.api.GenericBinaryDocument
binaryDoc
private static byte
BINFLOAT
private static byte
BINGET
private static byte
BININT
private static byte
BININT1
private static byte
BININT2
private static byte
BINPUT
private static byte
BINSTRING
private static byte
BINUNICODE
private javajs.util.Lst<java.lang.Object>
build
private static byte
BUILD
private static byte
EMPTY_DICT
private static byte
EMPTY_LIST
private static byte
EMPTY_TUPLE
private int
emptyListPt
private int
filePt
private static byte
GLOBAL
private int
id
private boolean
inMovie
private boolean
inNames
private static byte
INT
private int
ipt
private int
lastMark
private boolean
logging
private static byte
LONG
private static byte
LONG_BINGET
private static byte
LONG_BINPUT
private static byte
MARK
private int
markCount
private javajs.util.Lst<java.lang.Integer>
marks
private java.util.Map<java.lang.Object,java.lang.Object>
memo
private static byte
NONE
private static byte
OBJ
private static byte
REDUCE
private int
retrieveCount
private static byte
SETITEM
private static byte
SETITEMS
private static byte
SHORT_BINSTRING
private javajs.util.Lst<java.lang.Object>
stack
private static byte
STOP
private java.lang.String
thisName
private java.lang.Object
thisSection
private static byte
TUPLE
private Viewer
vwr
-
Constructor Summary
Constructors Constructor Description PickleReader(javajs.api.GenericBinaryDocument doc, Viewer vwr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
bytesToString(java.lang.Object o)
(package private) java.util.Map<java.lang.String,java.lang.Object>
getMap(boolean logging)
private int
getMark()
private java.lang.Object
getMemo(int i)
private javajs.util.Lst<java.lang.Object>
getObjects(int mark)
private void
log(java.lang.String s)
private java.lang.Object
peek()
private java.lang.Object
pop()
private void
push(java.lang.Object o)
private void
putMark(int i)
private void
putMemo(int i, boolean doCheck)
private byte[]
readStringAsBytes()
-
-
-
Field Detail
-
vwr
private Viewer vwr
-
binaryDoc
private javajs.api.GenericBinaryDocument binaryDoc
-
stack
private javajs.util.Lst<java.lang.Object> stack
-
marks
private javajs.util.Lst<java.lang.Integer> marks
-
build
private javajs.util.Lst<java.lang.Object> build
-
memo
private java.util.Map<java.lang.Object,java.lang.Object> memo
-
logging
private boolean logging
-
id
private int id
-
markCount
private int markCount
-
filePt
private int filePt
-
emptyListPt
private int emptyListPt
-
thisSection
private java.lang.Object thisSection
-
inMovie
private boolean inMovie
-
inNames
private boolean inNames
-
thisName
private java.lang.String thisName
-
lastMark
private int lastMark
-
retrieveCount
private int retrieveCount
-
APPEND
private static final byte APPEND
- See Also:
- Constant Field Values
-
APPENDS
private static final byte APPENDS
- See Also:
- Constant Field Values
-
BINFLOAT
private static final byte BINFLOAT
- See Also:
- Constant Field Values
-
BININT
private static final byte BININT
- See Also:
- Constant Field Values
-
BININT1
private static final byte BININT1
- See Also:
- Constant Field Values
-
BININT2
private static final byte BININT2
- See Also:
- Constant Field Values
-
BINPUT
private static final byte BINPUT
- See Also:
- Constant Field Values
-
BINSTRING
private static final byte BINSTRING
- See Also:
- Constant Field Values
-
BINUNICODE
private static final byte BINUNICODE
- See Also:
- Constant Field Values
-
BUILD
private static final byte BUILD
- See Also:
- Constant Field Values
-
EMPTY_DICT
private static final byte EMPTY_DICT
- See Also:
- Constant Field Values
-
EMPTY_LIST
private static final byte EMPTY_LIST
- See Also:
- Constant Field Values
-
GLOBAL
private static final byte GLOBAL
- See Also:
- Constant Field Values
-
LONG_BINPUT
private static final byte LONG_BINPUT
- See Also:
- Constant Field Values
-
MARK
private static final byte MARK
- See Also:
- Constant Field Values
-
NONE
private static final byte NONE
- See Also:
- Constant Field Values
-
OBJ
private static final byte OBJ
- See Also:
- Constant Field Values
-
SETITEM
private static final byte SETITEM
- See Also:
- Constant Field Values
-
SETITEMS
private static final byte SETITEMS
- See Also:
- Constant Field Values
-
SHORT_BINSTRING
private static final byte SHORT_BINSTRING
- See Also:
- Constant Field Values
-
STOP
private static final byte STOP
- See Also:
- Constant Field Values
-
BINGET
private static final byte BINGET
- See Also:
- Constant Field Values
-
LONG_BINGET
private static final byte LONG_BINGET
- See Also:
- Constant Field Values
-
TUPLE
private static final byte TUPLE
- See Also:
- Constant Field Values
-
INT
private static final byte INT
- See Also:
- Constant Field Values
-
EMPTY_TUPLE
private static final byte EMPTY_TUPLE
- See Also:
- Constant Field Values
-
LONG
private static final byte LONG
- See Also:
- Constant Field Values
-
REDUCE
private static final byte REDUCE
- See Also:
- Constant Field Values
-
ipt
private int ipt
-
aTemp
byte[] aTemp
-
-
Constructor Detail
-
PickleReader
PickleReader(javajs.api.GenericBinaryDocument doc, Viewer vwr)
-
-
Method Detail
-
log
private void log(java.lang.String s)
-
getMap
java.util.Map<java.lang.String,java.lang.Object> getMap(boolean logging) throws java.lang.Exception
- Parameters:
logging
-- Returns:
- Throws:
java.lang.Exception
-
bytesToString
private java.lang.String bytesToString(java.lang.Object o)
-
putMemo
private void putMemo(int i, boolean doCheck)
-
getMemo
private java.lang.Object getMemo(int i)
-
getObjects
private javajs.util.Lst<java.lang.Object> getObjects(int mark)
-
readStringAsBytes
private byte[] readStringAsBytes() throws java.lang.Exception
- Throws:
java.lang.Exception
-
putMark
private void putMark(int i)
-
getMark
private int getMark()
-
push
private void push(java.lang.Object o)
-
peek
private java.lang.Object peek()
-
pop
private java.lang.Object pop()
-
-