xref: /aoo42x/main/udkapi/com/sun/star/io/XInputStream.idl (revision cdf0e10c)
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_XInputStream_idl__
28*cdf0e10cSrcweir#define __com_sun_star_io_XInputStream_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
31*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
32*cdf0e10cSrcweir#endif
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir#ifndef __com_sun_star_io_NotConnectedException_idl__
35*cdf0e10cSrcweir#include <com/sun/star/io/NotConnectedException.idl>
36*cdf0e10cSrcweir#endif
37*cdf0e10cSrcweir
38*cdf0e10cSrcweir#ifndef __com_sun_star_io_BufferSizeExceededException_idl__
39*cdf0e10cSrcweir#include <com/sun/star/io/BufferSizeExceededException.idl>
40*cdf0e10cSrcweir#endif
41*cdf0e10cSrcweir
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir//=============================================================================
44*cdf0e10cSrcweir
45*cdf0e10cSrcweirmodule com {  module sun {  module star {  module io {
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir//=============================================================================
48*cdf0e10cSrcweir
49*cdf0e10cSrcweir// DocMerge from xml: interface com::sun::star::io::XInputStream
50*cdf0e10cSrcweir/** This is the basic interface to read data from a stream.
51*cdf0e10cSrcweir    <p>
52*cdf0e10cSrcweir    See the <a href="http://udk.openoffice.org/common/man/concept/streams.html">
53*cdf0e10cSrcweir    streaming document</a> for further information on chaining and piping streams.
54*cdf0e10cSrcweir */
55*cdf0e10cSrcweirpublished interface XInputStream: com::sun::star::uno::XInterface
56*cdf0e10cSrcweir{
57*cdf0e10cSrcweir	//-------------------------------------------------------------------------
58*cdf0e10cSrcweir
59*cdf0e10cSrcweir	// DocMerge from xml: method com::sun::star::io::XInputStream::readBytes
60*cdf0e10cSrcweir	/** reads the specified number of bytes in the given sequence.
61*cdf0e10cSrcweir
62*cdf0e10cSrcweir		<p>The return value specifies the number of bytes which have been
63*cdf0e10cSrcweir		put into the sequence. A difference between <var>nBytesToRead</var>
64*cdf0e10cSrcweir		and the return value indicates that EOF has been reached. This means
65*cdf0e10cSrcweir		that the method blocks until the specified number of bytes are
66*cdf0e10cSrcweir		available or the EOF is reached.  </p>
67*cdf0e10cSrcweir	   @param aData
68*cdf0e10cSrcweir	         after the call, the byte sequence contains the requested number
69*cdf0e10cSrcweir			 of bytes (or less as a sign of EOF).
70*cdf0e10cSrcweir
71*cdf0e10cSrcweir			 <p>
72*cdf0e10cSrcweir			 C++ only : Note that for unbridged (e.g., in-process)
73*cdf0e10cSrcweir			 calls, using the same sequence for repetive readBytes()-calls
74*cdf0e10cSrcweir			 can bear a performance advantage. The callee can put the data
75*cdf0e10cSrcweir			 directly into the sequence so that no buffer reallocation is
76*cdf0e10cSrcweir			 necessary.
77*cdf0e10cSrcweir			 But this holds only when
78*cdf0e10cSrcweir			 <ol>
79*cdf0e10cSrcweir			  <li> neither caller nor callee keep a second reference to the same
80*cdf0e10cSrcweir			       sequence.
81*cdf0e10cSrcweir			  <li> the sequence is pre-allocated with the requested number of bytes.
82*cdf0e10cSrcweir			  <li> the same sequence is reused ( simply preallocationg a new
83*cdf0e10cSrcweir			       sequence for every call bears no advantage ).
84*cdf0e10cSrcweir			  <li> the call is not bridged (e.g., betweeen different compilers
85*cdf0e10cSrcweir			       or different processes ).
86*cdf0e10cSrcweir			 </ol>
87*cdf0e10cSrcweir
88*cdf0e10cSrcweir			 If the same 'optimized' code runs against an interface in a different process,
89*cdf0e10cSrcweir			 there is an unnecessary memory allocation/deallocation (the out parameter
90*cdf0e10cSrcweir			 is of course NOT transported over the connection), but this should
91*cdf0e10cSrcweir			 be negligible compared to a synchron call.
92*cdf0e10cSrcweir	     @param nBytesToRead
93*cdf0e10cSrcweir		the total number of bytes to read
94*cdf0e10cSrcweir	 */
95*cdf0e10cSrcweir	long readBytes( [out] sequence<byte> aData,
96*cdf0e10cSrcweir			 [in] long nBytesToRead )
97*cdf0e10cSrcweir			raises( com::sun::star::io::NotConnectedException,
98*cdf0e10cSrcweir					com::sun::star::io::BufferSizeExceededException,
99*cdf0e10cSrcweir					com::sun::star::io::IOException);
100*cdf0e10cSrcweir
101*cdf0e10cSrcweir	//-------------------------------------------------------------------------
102*cdf0e10cSrcweir
103*cdf0e10cSrcweir	// DocMerge from xml: method com::sun::star::io::XInputStream::readSomeBytes
104*cdf0e10cSrcweir	/** reads the available number of bytes, at maximum
105*cdf0e10cSrcweir		<var>nMaxBytesToRead</var>.
106*cdf0e10cSrcweir
107*cdf0e10cSrcweir		<p>This method is very similar to the readBytes method, except that
108*cdf0e10cSrcweir           it has different blocking behaviour.
109*cdf0e10cSrcweir           The method blocks as long as at least 1 byte is available or
110*cdf0e10cSrcweir           EOF has been reached. EOF has only been reached, when the method
111*cdf0e10cSrcweir           returns 0 and the corresponding byte sequence is empty.
112*cdf0e10cSrcweir           Otherwise, after the call, aData contains the available,
113*cdf0e10cSrcweir           but no more than nMaxBytesToRead, bytes.
114*cdf0e10cSrcweir        @param aData contains the data read from the stream.
115*cdf0e10cSrcweir        @param nMaxBytesToRead The maximum number of bytes to be read from this
116*cdf0e10cSrcweir                               stream during the call.
117*cdf0e10cSrcweir        @see com::sun::star::io::XInputStream::readBytes
118*cdf0e10cSrcweir	 */
119*cdf0e10cSrcweir	long readSomeBytes( [out] sequence<byte> aData,
120*cdf0e10cSrcweir			 [in] long nMaxBytesToRead )
121*cdf0e10cSrcweir			raises( com::sun::star::io::NotConnectedException,
122*cdf0e10cSrcweir					com::sun::star::io::BufferSizeExceededException,
123*cdf0e10cSrcweir					com::sun::star::io::IOException );
124*cdf0e10cSrcweir
125*cdf0e10cSrcweir	//-------------------------------------------------------------------------
126*cdf0e10cSrcweir
127*cdf0e10cSrcweir	// DocMerge from xml: method com::sun::star::io::XInputStream::skipBytes
128*cdf0e10cSrcweir	/** skips the next <var>nBytesToSkip</var> bytes (must be positive).
129*cdf0e10cSrcweir
130*cdf0e10cSrcweir		<p>It is up to the implementation whether this method is
131*cdf0e10cSrcweir		blocking the thread or not.  </p>
132*cdf0e10cSrcweir	  @param nBytesToSkip
133*cdf0e10cSrcweir		number of bytes to skip
134*cdf0e10cSrcweir	 */
135*cdf0e10cSrcweir	void skipBytes( [in] long nBytesToSkip )
136*cdf0e10cSrcweir			raises( com::sun::star::io::NotConnectedException,
137*cdf0e10cSrcweir					com::sun::star::io::BufferSizeExceededException,
138*cdf0e10cSrcweir					com::sun::star::io::IOException );
139*cdf0e10cSrcweir
140*cdf0e10cSrcweir	//-------------------------------------------------------------------------
141*cdf0e10cSrcweir
142*cdf0e10cSrcweir	// DocMerge from xml: method com::sun::star::io::XInputStream::available
143*cdf0e10cSrcweir	/** states how many bytes can be read or skipped without blocking.
144*cdf0e10cSrcweir
145*cdf0e10cSrcweir		<p>Note: This method offers no information on whether the EOF
146*cdf0e10cSrcweir		has been reached.  </p>
147*cdf0e10cSrcweir	 */
148*cdf0e10cSrcweir	long available()
149*cdf0e10cSrcweir			raises( com::sun::star::io::NotConnectedException,
150*cdf0e10cSrcweir					com::sun::star::io::IOException
151*cdf0e10cSrcweir					);
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir	//-------------------------------------------------------------------------
154*cdf0e10cSrcweir
155*cdf0e10cSrcweir	// DocMerge from xml: method com::sun::star::io::XInputStream::closeInput
156*cdf0e10cSrcweir	/** closes the stream.
157*cdf0e10cSrcweir
158*cdf0e10cSrcweir		<p>Users must close the stream explicitly when no further
159*cdf0e10cSrcweir		reading should be done. (There may exist ring references to
160*cdf0e10cSrcweir		chained objects that can only be released during this call.
161*cdf0e10cSrcweir		Thus not calling this method would result in a leak of memory or
162*cdf0e10cSrcweir		external resources.) </p>
163*cdf0e10cSrcweir	 */
164*cdf0e10cSrcweir	void closeInput()
165*cdf0e10cSrcweir			raises( com::sun::star::io::NotConnectedException,
166*cdf0e10cSrcweir					com::sun::star::io::IOException);
167*cdf0e10cSrcweir
168*cdf0e10cSrcweir};
169*cdf0e10cSrcweir
170*cdf0e10cSrcweir//=============================================================================
171*cdf0e10cSrcweir
172*cdf0e10cSrcweir}; }; }; };
173*cdf0e10cSrcweir
174*cdf0e10cSrcweir/*=============================================================================
175*cdf0e10cSrcweir
176*cdf0e10cSrcweir=============================================================================*/
177*cdf0e10cSrcweir#endif
178