Skip to content

Commit 9185242

Browse files
committed
Add a length format argument in _readString
1 parent 5f5b611 commit 9185242

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

javaobj.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,15 @@ def _readStruct(self, unpack):
561561

562562
return struct.unpack(unpack, ba)
563563

564-
def _readString(self):
564+
def _readString(self, length_fmt="H"):
565565
"""
566566
Reads a serialized string
567567
568+
:param length_fmt: Structure format of the string length (H or Q)
568569
:return: The deserialized string
569570
:raise RuntimeError: Unexpected end of stream
570571
"""
571-
(length,) = self._readStruct(">H")
572+
(length,) = self._readStruct(">{0}".format(length_fmt))
572573
ba = self.object_stream.read(length)
573574
return to_str(ba)
574575

0 commit comments

Comments
 (0)