filedb.structfile module¶
Classes¶
- class whoosh.filedb.structfile.StructFile(fileobj: BinaryIO, name: str | None = None, onclose: Callable[[StructFile], None] | None = None)[source]¶
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”.
- flush() None[source]¶
Flushes the buffer of the wrapped file. This is a no-op if the wrapped file does not have a flush method.
- read_tagint() int[source]¶
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.
- write_byte(n: int) None[source]¶
Writes a single byte to the wrapped file, shortcut for
file.write(chr(n)).
- write_pickle(obj: Any, protocol: int = -1) None[source]¶
Writes a pickled representation of obj to the wrapped file.
- write_string(s: bytes) None[source]¶
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.