httk.core.datastream.textstream_file_view¶
Classes¶
A view presenting an underlying data streaming backend via the full io.TextIOBase API, which is a superset of TextstreamAPI. |
Module Contents¶
- class httk.core.datastream.textstream_file_view.TextstreamFileView(obj, **hints)¶
Bases:
httk.core.datastream.textstream_view.TextstreamView,io.TextIOBase,httk.core.datastream.textstream_api.TextstreamAPIA view presenting an underlying data streaming backend via the full io.TextIOBase API, which is a superset of TextstreamAPI.
- Parameters:
obj (httk.core.datastream.textstream_like.TextstreamLike) – Text-stream source to present through the text file API.
**hints (Any) – Backend-selection, encoding, and compression hints.
- unwrap()¶
Return the raw representation of the wrapped backend.
- Returns:
The backend’s most raw available representation.
- Return type:
Any
- close()¶
Close the underlying backend.
- seekable()¶
Report whether the backend supports seeking and telling.
- Returns:
Whether both operations are available.
- Return type:
- flush()¶
Flush the backend when it provides flushing.
- Raises:
ValueError – If the view is closed.
- read(size=-1)¶
Read up to
sizecharacters, or all remaining characters whensizeis negative.- Parameters:
size (int | None) – Maximum number of characters to read;
Nonealso means all remaining characters.- Returns:
The text read from the stream.
- Raises:
ValueError – If the view is closed.
- Return type:
- readline(size=-1)¶
Read one line, optionally limited to
sizecharacters.- Parameters:
size (int | None) – Maximum number of characters to read;
Nonemeans no limit.- Returns:
The line read, including its newline when present.
- Raises:
ValueError – If the view is closed.
- Return type:
- readlines(hint=-1)¶
Read lines until EOF or until the accumulated size reaches
hint.- Parameters:
hint (int) – Approximate minimum number of characters to collect, or a negative value for no limit.
- Returns:
The lines read from the stream.
- Raises:
ValueError – If the view is closed.
- Return type:
- seek(offset, whence=io.SEEK_SET)¶
Move the stream position and discard buffered line data.
- Parameters:
- Returns:
The resulting absolute stream position.
- Raises:
ValueError – If the view is closed.
io.UnsupportedOperation – If the backend is not seekable.
- Return type:
- tell()¶
Return the logical stream position before buffered line data.
- Returns:
The logical absolute stream position.
- Raises:
ValueError – If the view is closed.
io.UnsupportedOperation – If the backend does not support telling.
- Return type:
- detach()¶
Reject detaching because the view owns its backend interface.
- Raises:
io.UnsupportedOperation – Always, because detaching is unsupported.