1*cdf0e10cSrcweir/************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir#ifndef __com_sun_star_io_XTextInputStream_idl__ 28*cdf0e10cSrcweir#define __com_sun_star_io_XTextInputStream_idl__ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir#ifndef __com_sun_star_io_XInputStream_idl__ 31*cdf0e10cSrcweir#include <com/sun/star/io/XInputStream.idl> 32*cdf0e10cSrcweir#endif 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir#ifndef __com_sun_star_io_IOException_idl__ 35*cdf0e10cSrcweir#include <com/sun/star/io/IOException.idl> 36*cdf0e10cSrcweir#endif 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir//============================================================================= 40*cdf0e10cSrcweir 41*cdf0e10cSrcweirmodule com { module sun { module star { module io { 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir//============================================================================= 44*cdf0e10cSrcweir/** Interface to read strings from a stream. 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir <p>This interfaces allows to read strings seperated by 47*cdf0e10cSrcweir delimiters and to read lines. The character encoding 48*cdf0e10cSrcweir to be used can be set by <member>setEncoding()</member>. 49*cdf0e10cSrcweir Default encoding is "utf8".</p> 50*cdf0e10cSrcweir */ 51*cdf0e10cSrcweirpublished interface XTextInputStream: com::sun::star::io::XInputStream 52*cdf0e10cSrcweir{ 53*cdf0e10cSrcweir //------------------------------------------------------------------------- 54*cdf0e10cSrcweir /** reads text until a line break (CR, LF, or CR/LF) or 55*cdf0e10cSrcweir EOF is found and returns it as string (without CR, LF). 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir <p>The read characters are converted according to the 58*cdf0e10cSrcweir encoding defined by <member>setEncoding</member>. If 59*cdf0e10cSrcweir EOF is already reached before calling this method 60*cdf0e10cSrcweir an empty string is returned.<p> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir @see setEncoding 63*cdf0e10cSrcweir @see isEOF 64*cdf0e10cSrcweir */ 65*cdf0e10cSrcweir string readLine() 66*cdf0e10cSrcweir raises( com::sun::star::io::IOException ); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir //------------------------------------------------------------------------- 69*cdf0e10cSrcweir /** reads text until one of the given delimiter characters 70*cdf0e10cSrcweir or EOF is found and returns it as string (without delimiter). 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir <p><strong>Important:</strong> CR/LF is not used as default 73*cdf0e10cSrcweir delimiter! So if no delimiter is defined or none of the 74*cdf0e10cSrcweir delimiters is found, the stream will be read to EOF. The 75*cdf0e10cSrcweir read characters are converted according to the encoding 76*cdf0e10cSrcweir defined by <member>setEncoding</member>. If EOF is already 77*cdf0e10cSrcweir reached before calling this method an empty string is returned.</p> 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir @see setEncoding 80*cdf0e10cSrcweir @see isEOF 81*cdf0e10cSrcweir */ 82*cdf0e10cSrcweir string readString( [in] sequence<char> Delimiters, [in] boolean bRemoveDelimiter ) 83*cdf0e10cSrcweir raises( com::sun::star::io::IOException ); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir //------------------------------------------------------------------------- 86*cdf0e10cSrcweir /** Returns the EOF status. 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir <p>This method has to be used to detect if the end 89*cdf0e10cSrcweir of the stream is reached.</p> 90*cdf0e10cSrcweir <p><strong>Important:</strong> 91*cdf0e10cSrcweir This cannot be detected by asking for an empty string 92*cdf0e10cSrcweir because that can be a valid return value of <member> 93*cdf0e10cSrcweir readLine()</member> (if the line is empty) and 94*cdf0e10cSrcweir readString() (if a delimiter is directly followed 95*cdf0e10cSrcweir by the next one).</p> 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir @returns 98*cdf0e10cSrcweir <TRUE/>, if the end of file is reached, so that 99*cdf0e10cSrcweir no next string can be read. <FALSE/> otherwise 100*cdf0e10cSrcweir */ 101*cdf0e10cSrcweir boolean isEOF() 102*cdf0e10cSrcweir raises( com::sun::star::io::IOException ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir //------------------------------------------------------------------------- 105*cdf0e10cSrcweir /** sets character encoding. 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir @param Encoding 108*cdf0e10cSrcweir sets the character encoding that should be used. 109*cdf0e10cSrcweir The character encoding names refer to the document 110*cdf0e10cSrcweir http://www.iana.org/assignments/character-sets. 111*cdf0e10cSrcweir Which character sets are supported depends on 112*cdf0e10cSrcweir the implementation. 113*cdf0e10cSrcweir */ 114*cdf0e10cSrcweir void setEncoding( [in] string Encoding ); 115*cdf0e10cSrcweir}; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir//============================================================================= 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir}; }; }; }; 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir#endif 122