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