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