xref: /trunk/main/vos/inc/vos/istream.hxx (revision 1be3ed10)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _VOS_ISTREAM_HXX_
25 #define _VOS_ISTREAM_HXX_
26 
27 #include "sal/types.h"
28 #	include	<vos/types.hxx>
29 
30 namespace vos
31 {
32 
33 /** Interface for a stream of data, on that you can read and write blocks of bytes.
34 */
35 class IStream
36 {
37 public:
38 
IStream()39     IStream() { }
~IStream()40     virtual ~IStream() { }
41 
42 
43 	/** Retrieve n bytes from the stream and copy them into pBuffer.
44 		@param pBuffer receives the read data.
45 		@param n the number of bytes to read. pBuffer must be large enough
46 		to hold the n bytes!
47 		@return the number of read bytes
48 	*/
49     virtual sal_Int32 SAL_CALL read(void* pBuffer,
50 					     sal_uInt32 n) const= 0;
51 
52 	/** Write n bytes from pBuffer to the stream.
53 		@param pBuffer contains the data to be written.
54 		@param n the number of bytes to write.
55 		@return the number of written bytes
56 	*/
57     virtual sal_Int32 SAL_CALL write(const void* pBuffer,
58 					      sal_uInt32 n)= 0;
59 
60 	/** Checks if stream is closed for further reading.
61 		@return True is stream has ended (e.g. was closed).
62 	*/
63 	virtual sal_Bool SAL_CALL isEof() const = 0;
64 };
65 
66 }
67 
68 #endif	// _VOS_ISTREAM_HXX_
69 
70