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 10408a4873SAndrew Rist * 11408a4873SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12408a4873SAndrew Rist * 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. 19408a4873SAndrew Rist * 20408a4873SAndrew Rist *************************************************************/ 21408a4873SAndrew Rist 22408a4873SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_io_XAsyncOutputMonitor_idl__ 25cdf0e10cSrcweir#define __com_sun_star_io_XAsyncOutputMonitor_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#ifndef __com_sun_star_io_IOException_idl__ 28cdf0e10cSrcweir#include "com/sun/star/io/IOException.idl" 29cdf0e10cSrcweir#endif 30cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__ 31cdf0e10cSrcweir#include "com/sun/star/uno/XInterface.idl" 32cdf0e10cSrcweir#endif 33cdf0e10cSrcweir 34cdf0e10cSrcweirmodule com { module sun { module star { module io { 35cdf0e10cSrcweir 36cdf0e10cSrcweir/** 37cdf0e10cSrcweir An optional companion interface to 38cdf0e10cSrcweir <type scope="com::sun::star::io">XOutputStream</type> that supports scenarios 39cdf0e10cSrcweir where <member scope="com::sun::star::io">XOutputStream::writeBytes</member> 40cdf0e10cSrcweir operates asynchronously and does not necessarily report any errors. 41cdf0e10cSrcweir 42cdf0e10cSrcweir <p>A typical scenario where this interface is useful is when an 43cdf0e10cSrcweir <type scope="com::sun::star::io">XOutputStream</type> is used to write to a 44cdf0e10cSrcweir file via NFS. Normally, any calls to 45cdf0e10cSrcweir <member scope="com::sun::star::io">XOutputStream::writeBytes</member> will 46cdf0e10cSrcweir execute asynchronously then, in that any potential errors might only be 47cdf0e10cSrcweir reported by later calls to 48cdf0e10cSrcweir <member scope="com::sun::star::io">XOutputStream::writeBytes</member> or 49cdf0e10cSrcweir <member scope="com::sun::star::io">XOutputStream::closeOutput</member>. If 50cdf0e10cSrcweir such an output stream shall not be closed immediately after one or more calls 51cdf0e10cSrcweir to <member scope="com::sun::star::io">XOutputStream::writeBytes</member>, but 52cdf0e10cSrcweir the client wants to know as soon as possible whether writing was successful, 53cdf0e10cSrcweir then <member 54cdf0e10cSrcweir scope="com::sun::star::io">XAsyncOutputMonitor::waitForCompletion</member> 55cdf0e10cSrcweir should be called after the series of calls to 56cdf0e10cSrcweir <member scope="com::sun::star::io">XOutputStream::writeBytes</member>.</p> 57cdf0e10cSrcweir 58*95a17a32SJürgen Schmidt @since OpenOffice 2.0 59cdf0e10cSrcweir*/ 60cdf0e10cSrcweirinterface XAsyncOutputMonitor { 61cdf0e10cSrcweir /** 62cdf0e10cSrcweir waits for the completion of any previous calls to 63cdf0e10cSrcweir <member scope="com::sun::star::io">XOutputStream::writeBytes</member>, 64cdf0e10cSrcweir and reports potentially pending errors. 65cdf0e10cSrcweir 66cdf0e10cSrcweir <p>Calling this method is potentially expensive (even if the associated 67cdf0e10cSrcweir <type scope="com::sun::star::io">XOutputStream</type> represents a local 68cdf0e10cSrcweir file not accessed via NFS, for example). This method has a similar 69cdf0e10cSrcweir description to 70cdf0e10cSrcweir <member scope="com::sun::star::io">XOutputStream::flush</member>. 71cdf0e10cSrcweir However, where the semantics of <code>flush</code> are rather vague, 72cdf0e10cSrcweir <code>waitForCompletion</code> has very specific semantics—it just 73cdf0e10cSrcweir blocks long enough so that any errors encountered during previous calls 74cdf0e10cSrcweir to <member scope="com::sun::star::io">XOutputStream::writeBytes</member> 75cdf0e10cSrcweir can reliably be reported. It specificially does not guarantee that any 76cdf0e10cSrcweir data have savely been stored on a stable physical medium, like a hard 77cdf0e10cSrcweir disk (and it is completely unspecified whether <code>flush</code> should 78cdf0e10cSrcweir give this guarantee).</p> 79cdf0e10cSrcweir 80cdf0e10cSrcweir @throws com::sun::star::io::IOException 81cdf0e10cSrcweir if any previous call to <member 82cdf0e10cSrcweir scope="com::sun::star::io">XOutputStream::writeBytes</member> encountered 83cdf0e10cSrcweir such an error, but has not yet reported it (in cases where 84cdf0e10cSrcweir <code>writeBytes</code> operates asynchronously). 85cdf0e10cSrcweir */ 86cdf0e10cSrcweir void waitForCompletion() raises (IOException); 87cdf0e10cSrcweir}; 88cdf0e10cSrcweir 89cdf0e10cSrcweir}; }; }; }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir#endif 92