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