ooodev.adapter.io.text_input_stream_partial module

class ooodev.adapter.io.text_input_stream_partial.TextInputStreamPartial(component, interface=com.sun.star.io.XTextInputStream)[source]

Bases: InputStreamPartial

Partial Class XTextInputStream.

Parameters:
  • component (XTextInputStream) –

  • interface (UnoInterface | None) –

__init__(component, interface=com.sun.star.io.XTextInputStream)[source]

Constructor

Parameters:
  • component (XTextInputStream) – UNO Component that implements com.sun.star.io.XTextInputStream interface.

  • interface (UnoInterface, optional) – The interface to be validated. Defaults to XTextInputStream.

Return type:

None

is_eof()[source]

Returns the EOF status.

This method has to be used to detect if the end of the stream is reached.

Important: This cannot be detected by asking for an empty string because that can be a valid return value of readLine() (if the line is empty) and readString() (if a delimiter is directly followed by the next one).

Raises:

com.sun.star.io.IOExceptionIOException

Return type:

bool

read_line()[source]

reads text until a line break (CR, LF, or CR/LF) or EOF is found and returns it as string (without CR, LF).

The read characters are converted according to the encoding defined by setEncoding(). If EOF is already reached before calling this method an empty string is returned.

Raises:

com.sun.star.io.IOExceptionIOException

Return type:

str

read_string(remove_delimiter, *delimiters)[source]

reads text until one of the given delimiter characters or EOF is found and returns it as string (without delimiter).

Important: CR/LF is not used as default delimiter! So if no delimiter is defined or none of the delimiters is found, the stream will be read to EOF. The read characters are converted according to the encoding defined by set_encoding(). If EOF is already reached before calling this method an empty string is returned.

Parameters:
  • remove_delimiter (bool) – If True, the delimiter character is not included in the returned string.

  • delimiters (str, optional) – One or more delimiter characters.

Raises:

com.sun.star.io.IOExceptionIOException

Return type:

str

set_encoding(encoding)[source]

sets character encoding.

Return type:

None

Parameters:

encoding (str) –