1*408a4873SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*408a4873SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*408a4873SAndrew Rist * distributed with this work for additional information 6*408a4873SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance 9*408a4873SAndrew Rist * with the License. You may obtain a copy of the License at 10*408a4873SAndrew Rist * 11*408a4873SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*408a4873SAndrew Rist * 13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*408a4873SAndrew Rist * software distributed under the License is distributed on an 15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*408a4873SAndrew Rist * KIND, either express or implied. See the License for the 17*408a4873SAndrew Rist * specific language governing permissions and limitations 18*408a4873SAndrew Rist * under the License. 19*408a4873SAndrew Rist * 20*408a4873SAndrew Rist *************************************************************/ 21*408a4873SAndrew Rist 22*408a4873SAndrew Rist 23cdf0e10cSrcweir#ifndef __com_sun_star_io_XTextInputStream_idl__ 24cdf0e10cSrcweir#define __com_sun_star_io_XTextInputStream_idl__ 25cdf0e10cSrcweir 26cdf0e10cSrcweir#ifndef __com_sun_star_io_XInputStream_idl__ 27cdf0e10cSrcweir#include <com/sun/star/io/XInputStream.idl> 28cdf0e10cSrcweir#endif 29cdf0e10cSrcweir 30cdf0e10cSrcweir#ifndef __com_sun_star_io_IOException_idl__ 31cdf0e10cSrcweir#include <com/sun/star/io/IOException.idl> 32cdf0e10cSrcweir#endif 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir//============================================================================= 36cdf0e10cSrcweir 37cdf0e10cSrcweirmodule com { module sun { module star { module io { 38cdf0e10cSrcweir 39cdf0e10cSrcweir//============================================================================= 40cdf0e10cSrcweir/** Interface to read strings from a stream. 41cdf0e10cSrcweir 42cdf0e10cSrcweir <p>This interfaces allows to read strings seperated by 43cdf0e10cSrcweir delimiters and to read lines. The character encoding 44cdf0e10cSrcweir to be used can be set by <member>setEncoding()</member>. 45cdf0e10cSrcweir Default encoding is "utf8".</p> 46cdf0e10cSrcweir */ 47cdf0e10cSrcweirpublished interface XTextInputStream: com::sun::star::io::XInputStream 48cdf0e10cSrcweir{ 49cdf0e10cSrcweir //------------------------------------------------------------------------- 50cdf0e10cSrcweir /** reads text until a line break (CR, LF, or CR/LF) or 51cdf0e10cSrcweir EOF is found and returns it as string (without CR, LF). 52cdf0e10cSrcweir 53cdf0e10cSrcweir <p>The read characters are converted according to the 54cdf0e10cSrcweir encoding defined by <member>setEncoding</member>. If 55cdf0e10cSrcweir EOF is already reached before calling this method 56cdf0e10cSrcweir an empty string is returned.<p> 57cdf0e10cSrcweir 58cdf0e10cSrcweir @see setEncoding 59cdf0e10cSrcweir @see isEOF 60cdf0e10cSrcweir */ 61cdf0e10cSrcweir string readLine() 62cdf0e10cSrcweir raises( com::sun::star::io::IOException ); 63cdf0e10cSrcweir 64cdf0e10cSrcweir //------------------------------------------------------------------------- 65cdf0e10cSrcweir /** reads text until one of the given delimiter characters 66cdf0e10cSrcweir or EOF is found and returns it as string (without delimiter). 67cdf0e10cSrcweir 68cdf0e10cSrcweir <p><strong>Important:</strong> CR/LF is not used as default 69cdf0e10cSrcweir delimiter! So if no delimiter is defined or none of the 70cdf0e10cSrcweir delimiters is found, the stream will be read to EOF. The 71cdf0e10cSrcweir read characters are converted according to the encoding 72cdf0e10cSrcweir defined by <member>setEncoding</member>. If EOF is already 73cdf0e10cSrcweir reached before calling this method an empty string is returned.</p> 74cdf0e10cSrcweir 75cdf0e10cSrcweir @see setEncoding 76cdf0e10cSrcweir @see isEOF 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir string readString( [in] sequence<char> Delimiters, [in] boolean bRemoveDelimiter ) 79cdf0e10cSrcweir raises( com::sun::star::io::IOException ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir //------------------------------------------------------------------------- 82cdf0e10cSrcweir /** Returns the EOF status. 83cdf0e10cSrcweir 84cdf0e10cSrcweir <p>This method has to be used to detect if the end 85cdf0e10cSrcweir of the stream is reached.</p> 86cdf0e10cSrcweir <p><strong>Important:</strong> 87cdf0e10cSrcweir This cannot be detected by asking for an empty string 88cdf0e10cSrcweir because that can be a valid return value of <member> 89cdf0e10cSrcweir readLine()</member> (if the line is empty) and 90cdf0e10cSrcweir readString() (if a delimiter is directly followed 91cdf0e10cSrcweir by the next one).</p> 92cdf0e10cSrcweir 93cdf0e10cSrcweir @returns 94cdf0e10cSrcweir <TRUE/>, if the end of file is reached, so that 95cdf0e10cSrcweir no next string can be read. <FALSE/> otherwise 96cdf0e10cSrcweir */ 97cdf0e10cSrcweir boolean isEOF() 98cdf0e10cSrcweir raises( com::sun::star::io::IOException ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir //------------------------------------------------------------------------- 101cdf0e10cSrcweir /** sets character encoding. 102cdf0e10cSrcweir 103cdf0e10cSrcweir @param Encoding 104cdf0e10cSrcweir sets the character encoding that should be used. 105cdf0e10cSrcweir The character encoding names refer to the document 106cdf0e10cSrcweir http://www.iana.org/assignments/character-sets. 107cdf0e10cSrcweir Which character sets are supported depends on 108cdf0e10cSrcweir the implementation. 109cdf0e10cSrcweir */ 110cdf0e10cSrcweir void setEncoding( [in] string Encoding ); 111cdf0e10cSrcweir}; 112cdf0e10cSrcweir 113cdf0e10cSrcweir//============================================================================= 114cdf0e10cSrcweir 115cdf0e10cSrcweir}; }; }; }; 116cdf0e10cSrcweir 117cdf0e10cSrcweir#endif 118