Update ooo320-m1
[ooovba.git] / xmlhelp / source / cxxhelp / provider / bufferedinputstream.hxx
blob9394ae1c2b70daca387642ef5b752f7a03250723
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: bufferedinputstream.hxx,v $
10 * $Revision: 1.3 $
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 ************************************************************************/
31 #include <cppuhelper/weak.hxx>
32 #include <osl/mutex.hxx>
33 #include <com/sun/star/io/XInputStream.hpp>
34 #include <com/sun/star/io/XSeekable.hpp>
37 namespace chelp {
39 class BufferedInputStream
40 : public cppu::OWeakObject,
41 public com::sun::star::io::XInputStream,
42 public com::sun::star::io::XSeekable
44 private:
46 sal_Int32 m_nBufferLocation;
47 sal_Int32 m_nBufferSize;
48 sal_Int8 *m_pBuffer;
49 osl::Mutex m_aMutex;
51 public:
53 BufferedInputStream(
54 const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream);
56 ~BufferedInputStream();
58 virtual com::sun::star::uno::Any SAL_CALL
59 queryInterface( const com::sun::star::uno::Type& rType )
60 throw( com::sun::star::uno::RuntimeException );
62 virtual void SAL_CALL acquire( void ) throw();
64 virtual void SAL_CALL release( void ) throw();
67 virtual sal_Int32 SAL_CALL readBytes( com::sun::star::uno::Sequence< sal_Int8 >& aData,
68 sal_Int32 nBytesToRead )
69 throw( com::sun::star::io::NotConnectedException,
70 com::sun::star::io::BufferSizeExceededException,
71 com::sun::star::io::IOException,
72 com::sun::star::uno::RuntimeException );
74 virtual sal_Int32 SAL_CALL readSomeBytes( com::sun::star::uno::Sequence< sal_Int8 >& aData,
75 sal_Int32 nMaxBytesToRead )
76 throw( com::sun::star::io::NotConnectedException,
77 com::sun::star::io::BufferSizeExceededException,
78 com::sun::star::io::IOException,
79 com::sun::star::uno::RuntimeException );
81 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
82 throw( com::sun::star::io::NotConnectedException,
83 com::sun::star::io::BufferSizeExceededException,
84 com::sun::star::io::IOException,
85 com::sun::star::uno::RuntimeException );
87 virtual sal_Int32 SAL_CALL available( void )
88 throw( com::sun::star::io::NotConnectedException,
89 com::sun::star::io::IOException,
90 com::sun::star::uno::RuntimeException );
92 virtual void SAL_CALL closeInput( void )
93 throw( com::sun::star::io::NotConnectedException,
94 com::sun::star::io::IOException,
95 com::sun::star::uno::RuntimeException );
97 virtual void SAL_CALL seek( sal_Int64 location )
98 throw( com::sun::star::lang::IllegalArgumentException,
99 com::sun::star::io::IOException,
100 com::sun::star::uno::RuntimeException );
102 virtual sal_Int64 SAL_CALL getPosition( void )
103 throw( com::sun::star::io::IOException,
104 com::sun::star::uno::RuntimeException );
106 virtual sal_Int64 SAL_CALL getLength( void )
107 throw( com::sun::star::io::IOException,
108 com::sun::star::uno::RuntimeException );
112 extern com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
113 turnToSeekable(
114 const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream);