xref: /aoo42x/main/package/inc/ByteChucker.hxx (revision f319bb99)
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 #ifndef _BYTE_CHUCKER_HXX_
24 #define _BYTE_CHUCKER_HXX_
25 
26 #include <com/sun/star/uno/Sequence.h>
27 #include <com/sun/star/uno/Reference.h>
28 #include <com/sun/star/io/BufferSizeExceededException.hpp>
29 #include <com/sun/star/io/IOException.hpp>
30 #include <com/sun/star/io/NotConnectedException.hpp>
31 #include <com/sun/star/uno/RuntimeException.hpp>
32 #include <com/sun/star/lang/IllegalArgumentException.hpp>
33 
34 namespace com { namespace sun { namespace star {
35 	namespace io { class XSeekable; class XOutputStream; }
36 } } }
37 class ByteChucker
38 {
39 protected:
40 	com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > xStream;
41 	com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xSeek;
42 	com::sun::star::uno::Sequence < sal_Int8 > a1Sequence, a2Sequence, a4Sequence;
43 	sal_Int8 * const p1Sequence, * const p2Sequence, * const p4Sequence;
44 
45 public:
46 	ByteChucker (com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xOstream);
47 	~ByteChucker();
48 
49     void WriteBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData )
50 		throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
51 
52     sal_Int64 GetPosition()
53 		throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
54 
55 	ByteChucker& operator << (sal_Int8 nInt8);
56 	ByteChucker& operator << (sal_Int16 nInt16);
57 	ByteChucker& operator << (sal_Int32 nInt32);
58 	ByteChucker& operator << (sal_uInt8 nuInt8);
59 	ByteChucker& operator << (sal_uInt16 nuInt16);
60 	ByteChucker& operator << (sal_uInt32 nuInt32);
61 };
62 
63 #endif
64