1*408a4873SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*408a4873SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*408a4873SAndrew Rist * distributed with this work for additional information
6*408a4873SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance
9*408a4873SAndrew Rist * with the License.  You may obtain a copy of the License at
10*408a4873SAndrew Rist *
11*408a4873SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*408a4873SAndrew Rist *
13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*408a4873SAndrew Rist * software distributed under the License is distributed on an
15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*408a4873SAndrew Rist * KIND, either express or implied.  See the License for the
17*408a4873SAndrew Rist * specific language governing permissions and limitations
18*408a4873SAndrew Rist * under the License.
19*408a4873SAndrew Rist *
20*408a4873SAndrew Rist *************************************************************/
21*408a4873SAndrew Rist
22*408a4873SAndrew Rist
23cdf0e10cSrcweir#ifndef _COM_SUN_STAR_CONNECTION_XCONNECTION_IDL_
24cdf0e10cSrcweir#define _COM_SUN_STAR_CONNECTION_XCONNECTION_IDL_
25cdf0e10cSrcweir
26cdf0e10cSrcweir#include <com/sun/star/io/IOException.idl>
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweirmodule com {  module sun {  module star {  module connection {
30cdf0e10cSrcweir
31cdf0e10cSrcweir/** A bidirectional bytestream.
32cdf0e10cSrcweir
33cdf0e10cSrcweir	<p> You should additionally implement XConnection2.
34cdf0e10cSrcweir
35cdf0e10cSrcweir	@see XConnection2
36cdf0e10cSrcweir */
37cdf0e10cSrcweirpublished interface XConnection: com::sun::star::uno::XInterface
38cdf0e10cSrcweir{
39cdf0e10cSrcweir
40cdf0e10cSrcweir	/** reads a requested number of bytes from the connection.
41cdf0e10cSrcweir		<p> This method is blocking, meaning that it always returns a bytesequence
42cdf0e10cSrcweir		with the requested number of bytes, unless it has reached end of file (which
43cdf0e10cSrcweir		often means, that close() has been called).
44cdf0e10cSrcweir
45cdf0e10cSrcweir		<p> please see also the readSomeBytes() method of XConnection2.
46cdf0e10cSrcweir
47cdf0e10cSrcweir		@return The read number of bytes.
48cdf0e10cSrcweir				The return value and the length of the
49cdf0e10cSrcweir				returned sequence must be identical.
50cdf0e10cSrcweir		@param nBytesToRead
51cdf0e10cSrcweir		        The number of bytes to be read from the stream.
52cdf0e10cSrcweir
53cdf0e10cSrcweir		@throws com::sun::star::io::IOException
54cdf0e10cSrcweir		       in case an error occurred during reading from the stream.
55cdf0e10cSrcweir	 */
56cdf0e10cSrcweir	long read( [out] sequence < byte > aReadBytes , [in] long nBytesToRead )
57cdf0e10cSrcweir			raises( com::sun::star::io::IOException );
58cdf0e10cSrcweir
59cdf0e10cSrcweir
60cdf0e10cSrcweir	// DocMerge from xml: method com::sun::star::connection::XConnection::write
61cdf0e10cSrcweir	/** writes the given bytesequence to the stream.
62cdf0e10cSrcweir		<p>The method blocks until the whole sequence is written.
63cdf0e10cSrcweir
64cdf0e10cSrcweir		@throws com::sun::star::io::IOException
65cdf0e10cSrcweir		       in case an error occurred during writing to the stream.
66cdf0e10cSrcweir	 */
67cdf0e10cSrcweir	void write( [in] sequence < byte > aData )
68cdf0e10cSrcweir		raises( com::sun::star::io::IOException );
69cdf0e10cSrcweir
70cdf0e10cSrcweir
71cdf0e10cSrcweir	/** Empties all internal buffers.
72cdf0e10cSrcweir	 */
73cdf0e10cSrcweir	void flush( )
74cdf0e10cSrcweir			raises( com::sun::star::io::IOException );
75cdf0e10cSrcweir
76cdf0e10cSrcweir	/** Immediately terminates any ongoing read or write calls.
77cdf0e10cSrcweir		All subsequent read or write calls()
78cdf0e10cSrcweir	 */
79cdf0e10cSrcweir	void close( )
80cdf0e10cSrcweir			raises( com::sun::star::io::IOException );
81cdf0e10cSrcweir
82cdf0e10cSrcweir
83cdf0e10cSrcweir	/** A unique string describing the connection.
84cdf0e10cSrcweir
85cdf0e10cSrcweir		<p>This string is different from the arguments to <member>XConnection::accept</member>
86cdf0e10cSrcweir		and <member>XConnector::connect</member>. In general, the string contains an additional
87cdf0e10cSrcweir		handle value.  For example, "socket,host=localhost,port=2002,uniqueValue=2324". </p>
88cdf0e10cSrcweir	 */
89cdf0e10cSrcweir	string getDescription();
90cdf0e10cSrcweir};
91cdf0e10cSrcweir
92cdf0e10cSrcweir};};};};
93cdf0e10cSrcweir
94cdf0e10cSrcweir#endif
95