LibreOffice
LibreOffice 7.4 SDK API Reference
Public Member Functions | List of all members
XTextInputStream Interface Referencepublished

Interface to read strings from a stream. More...

import"XTextInputStream.idl";

Inheritance diagram for XTextInputStream:
XInputStream XInterface XTextInputStream2 TextInputStream

Public Member Functions

string readLine () raises ( com::sun::star::io::IOException )
 reads text until a line break (CR, LF, or CR/LF) or EOF is found and returns it as string (without CR, LF). More...
 
string readString ([in] sequence< char > Delimiters, [in] boolean bRemoveDelimiter) raises ( com::sun::star::io::IOException )
 reads text until one of the given delimiter characters or EOF is found and returns it as string (without delimiter). More...
 
boolean isEOF () raises ( com::sun::star::io::IOException )
 Returns the EOF status. More...
 
void setEncoding ([in] string Encoding)
 sets character encoding. More...
 
- Public Member Functions inherited from XInputStream
long readBytes ([out] sequence< byte > aData, [in] long nBytesToRead) raises ( com::sun::star::io::NotConnectedException, com::sun::star::io::BufferSizeExceededException, com::sun::star::io::IOException)
 reads the specified number of bytes in the given sequence. More...
 
long readSomeBytes ([out] sequence< byte > aData, [in] long nMaxBytesToRead) raises ( com::sun::star::io::NotConnectedException, com::sun::star::io::BufferSizeExceededException, com::sun::star::io::IOException )
 reads the available number of bytes, at maximum nMaxBytesToRead. More...
 
void skipBytes ([in] long nBytesToSkip) raises ( com::sun::star::io::NotConnectedException, com::sun::star::io::BufferSizeExceededException, com::sun::star::io::IOException )
 skips the next nBytesToSkip bytes (must be positive). More...
 
long available () raises ( com::sun::star::io::NotConnectedException, com::sun::star::io::IOException )
 states how many bytes can be read or skipped without blocking. More...
 
void closeInput () raises ( com::sun::star::io::NotConnectedException, com::sun::star::io::IOException)
 closes the stream. More...
 
- Public Member Functions inherited from XInterface
any queryInterface ([in] type aType)
 queries for a new interface to an existing UNO object. More...
 
void acquire ()
 increases the reference counter by one. More...
 
void release ()
 decreases the reference counter by one. More...
 

Detailed Description

Interface to read strings from a stream.

This interfaces allows to read strings separated by delimiters and to read lines. The character encoding to be used can be set by setEncoding(). Default encoding is "utf8".

Member Function Documentation

◆ isEOF()

boolean isEOF ( )
raises (com::sun::star::io::IOException
)

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).

Returns
TRUE, if the end of file is reached, so that no next string can be read. FALSE otherwise

◆ readLine()

string readLine ( )
raises (com::sun::star::io::IOException
)

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.

See also
setEncoding
isEOF

◆ readString()

string readString ( [in] sequence< char >  Delimiters,
[in] boolean  bRemoveDelimiter 
)
raises (com::sun::star::io::IOException
)

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 setEncoding(). If EOF is already reached before calling this method an empty string is returned.

See also
setEncoding
isEOF

◆ setEncoding()

void setEncoding ( [in] string  Encoding)

sets character encoding.

Parameters
Encodingsets the character encoding that should be used. The character encoding names refer to the document http://www.iana.org/assignments/character-sets. Which character sets are supported depends on the implementation.

The documentation for this interface was generated from the following file: