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