update dev300-m58
[ooovba.git] / package / inc / ByteGrabber.hxx
blob067b506398feb9b322e6c2c8024cc24ac1d9e012
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ByteGrabber.hxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _BYTE_GRABBER_HXX_
31 #define _BYTE_GRABBER_HXX_
33 #include <com/sun/star/uno/Sequence.h>
34 #include <com/sun/star/uno/Reference.h>
35 #include <com/sun/star/io/BufferSizeExceededException.hpp>
36 #include <com/sun/star/io/IOException.hpp>
37 #include <com/sun/star/io/NotConnectedException.hpp>
38 #include <com/sun/star/uno/RuntimeException.hpp>
39 #include <com/sun/star/lang/IllegalArgumentException.hpp>
41 namespace com { namespace sun { namespace star {
42 namespace io { class XSeekable; class XInputStream; }
43 } } }
44 class ByteGrabber
46 protected:
47 com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
48 com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xSeek;
49 com::sun::star::uno::Sequence < sal_Int8 > aSequence;
50 const sal_Int8 *pSequence;
52 public:
53 ByteGrabber (com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xIstream);
54 ~ByteGrabber();
56 void setInputStream (com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewStream);
57 // XInputStream
58 sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
59 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
60 // XSeekable
61 sal_Int64 SAL_CALL seek( sal_Int64 location )
62 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
63 sal_Int64 SAL_CALL getPosition( )
64 throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
65 sal_Int64 SAL_CALL getLength( )
66 throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
68 ByteGrabber& operator >> (sal_Int8& rInt8);
69 ByteGrabber& operator >> (sal_Int16& rInt16);
70 ByteGrabber& operator >> (sal_Int32& rInt32);
71 ByteGrabber& operator >> (sal_uInt8& ruInt8);
72 ByteGrabber& operator >> (sal_uInt16& ruInt16);
73 ByteGrabber& operator >> (sal_uInt32& ruInt32);
76 #endif