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_CONNECTION_XCONNECTION_IDL_
28#define _COM_SUN_STAR_CONNECTION_XCONNECTION_IDL_
29
30#include <com/sun/star/io/IOException.idl>
31
32
33module com {  module sun {  module star {  module connection {
34
35/** A bidirectional bytestream.
36
37	<p> You should additionally implement XConnection2.
38
39	@see XConnection2
40 */
41published interface XConnection: com::sun::star::uno::XInterface
42{
43
44	/** reads a requested number of bytes from the connection.
45		<p> This method is blocking, meaning that it always returns a bytesequence
46		with the requested number of bytes, unless it has reached end of file (which
47		often means, that close() has been called).
48
49		<p> please see also the readSomeBytes() method of XConnection2.
50
51		@return The read number of bytes.
52				The return value and the length of the
53				returned sequence must be identical.
54		@param nBytesToRead
55		        The number of bytes to be read from the stream.
56
57		@throws com::sun::star::io::IOException
58		       in case an error occurred during reading from the stream.
59	 */
60	long read( [out] sequence < byte > aReadBytes , [in] long nBytesToRead )
61			raises( com::sun::star::io::IOException );
62
63
64	// DocMerge from xml: method com::sun::star::connection::XConnection::write
65	/** writes the given bytesequence to the stream.
66		<p>The method blocks until the whole sequence is written.
67
68		@throws com::sun::star::io::IOException
69		       in case an error occurred during writing to the stream.
70	 */
71	void write( [in] sequence < byte > aData )
72		raises( com::sun::star::io::IOException );
73
74
75	/** Empties all internal buffers.
76	 */
77	void flush( )
78			raises( com::sun::star::io::IOException );
79
80	/** Immediately terminates any ongoing read or write calls.
81		All subsequent read or write calls()
82	 */
83	void close( )
84			raises( com::sun::star::io::IOException );
85
86
87	/** A unique string describing the connection.
88
89		<p>This string is different from the arguments to <member>XConnection::accept</member>
90		and <member>XConnector::connect</member>. In general, the string contains an additional
91		handle value.  For example, "socket,host=localhost,port=2002,uniqueValue=2324". </p>
92	 */
93	string getDescription();
94};
95
96};};};};
97
98#endif
99