Returns a “structured file” object that wraps the given file object and
provides numerous additional methods for writing structured data, such as
“write_varint” and “write_long”.
-
close()
- Closes the wrapped file.
-
flush()
- Flushes the buffer of the wrapped file. This is a no-op if the
wrapped file does not have a flush method.
-
read_pickle()
- Reads a pickled object from the wrapped file.
-
read_string()
- Reads a string from the wrapped file.
-
read_svarint()
- Reads a variable-length encoded signed integer from the wrapped
file.
-
read_tagint()
- Reads a sometimes-compressed unsigned integer from the wrapped file.
This is similar to the varint methods but uses a less compressed but
faster format.
-
read_varint()
- Reads a variable-length encoded unsigned integer from the wrapped
file.
-
write_byte(n)
- Writes a single byte to the wrapped file, shortcut for
file.write(chr(n)).
-
write_pickle(obj, protocol=-1)
- Writes a pickled representation of obj to the wrapped file.
-
write_string(s)
- Writes a string to the wrapped file. This method writes the length
of the string first, so you can read the string back without having to
know how long it was.
-
write_svarint(i)
- Writes a variable-length signed integer to the wrapped file.
-
write_tagint(i)
- Writes a sometimes-compressed unsigned integer to the wrapped file.
This is similar to the varint methods but uses a less compressed but
faster format.
-
write_varint(i)
- Writes a variable-length unsigned integer to the wrapped file.