Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 19bd82c

Browse filesBrowse files
author
vbuell
committed
javaobj module extracted from peiping project to the new home.
git-svn-id: http://python-javaobj.googlecode.com/svn/trunk@21 003243c8-0679-609b-391f-34f4f14b4f20
1 parent 55c7756 commit 19bd82c
Copy full SHA for 19bd82c

File tree

Expand file treeCollapse file tree

4 files changed

+25
-115
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+25
-115
lines changed
Open diff view settings
Collapse file

‎eip_tests.py‎

Copy file name to clipboardExpand all lines: eip_tests.py
-25Lines changed: 0 additions & 25 deletions
This file was deleted.
Collapse file

‎javaobj.py‎

Copy file name to clipboardExpand all lines: javaobj.py
+25-4Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
1+
"""Provides functions for reading and writing (writing is WIP currently) Java objects
2+
serialized or will be deserialized by ObjectOutputStream. This form of object
3+
representation is a standard data interchange format in Java world.
4+
5+
javaobj module exposes an API familiar to users of the standard library marshal, pickle and json modules.
6+
7+
See: http://download.oracle.com/javase/6/docs/platform/serialization/spec/protocol.html
8+
"""
9+
110
import StringIO
211
import struct
312

4-
def loads(object):
13+
__version__ = "$Revision: 20 $"
14+
15+
def load(file_object):
516
"""
617
Deserializes Java primitive data and objects serialized by ObjectOutputStream
18+
from a file-like object.
19+
"""
20+
marshaller = JavaObjectUnmarshaller(file_object)
21+
return marshaller.readObject()
22+
23+
24+
def loads(string):
25+
"""
26+
Deserializes Java objects and primitive data serialized by ObjectOutputStream
727
from a string.
8-
See: http://download.oracle.com/javase/6/docs/platform/serialization/spec/protocol.html
928
"""
10-
f = StringIO.StringIO(object)
29+
f = StringIO.StringIO(string)
1130
marshaller = JavaObjectUnmarshaller(f)
1231
return marshaller.readObject()
1332

33+
1434
def dumps(object):
1535
"""
1636
Serializes Java primitive data and objects unmarshaled by load(s) before into string.
@@ -41,6 +61,7 @@ class JavaObject(object):
4161
def get_class(self):
4262
return self.classdesc
4363

64+
4465
class JavaObjectConstants:
4566

4667
STREAM_MAGIC = 0xaced
@@ -408,7 +429,7 @@ def _oops_dump_state(self):
408429
print "Warning!!!!: Stream still has %s bytes left." % len(the_rest)
409430
print self._create_hexdump(the_rest)
410431
print "=" * 30
411-
# =====================================================================================
432+
412433

413434
class JavaObjectMarshaller(JavaObjectConstants):
414435

Collapse file

‎peiping.py‎

Copy file name to clipboardExpand all lines: peiping.py
-41Lines changed: 0 additions & 41 deletions
This file was deleted.
Collapse file

‎peiping_http.py‎

Copy file name to clipboardExpand all lines: peiping_http.py
-45Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.