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