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 GIO_INPUTSTREAM_HXX 25 #define GIO_INPUTSTREAM_HXX 26 27 #include <sal/types.h> 28 #include <rtl/ustring.hxx> 29 #include <cppuhelper/weak.hxx> 30 31 #include <com/sun/star/io/XInputStream.hpp> 32 #include <com/sun/star/io/XTruncate.hpp> 33 #include <com/sun/star/io/XSeekable.hpp> 34 35 #include "gio_seekable.hxx" 36 37 namespace gio 38 { 39 40 class InputStream : 41 public ::com::sun::star::io::XInputStream, 42 public Seekable 43 { 44 private: 45 GFileInputStream *mpStream; 46 47 public: 48 InputStream ( GFileInputStream *pStream ); 49 virtual ~InputStream(); 50 51 // XInterface 52 virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type ) 53 throw( ::com::sun::star::uno::RuntimeException ); acquire(void)54 virtual void SAL_CALL acquire( void ) throw () { OWeakObject::acquire(); } release(void)55 virtual void SAL_CALL release( void ) throw() { OWeakObject::release(); } 56 57 // XInputStream 58 virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 > & aData, 59 sal_Int32 nBytesToRead ) 60 throw( ::com::sun::star::io::NotConnectedException, 61 ::com::sun::star::io::BufferSizeExceededException, 62 ::com::sun::star::io::IOException, 63 ::com::sun::star::uno::RuntimeException ); 64 65 virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 > & aData, 66 sal_Int32 nMaxBytesToRead ) 67 throw( ::com::sun::star::io::NotConnectedException, 68 ::com::sun::star::io::BufferSizeExceededException, 69 ::com::sun::star::io::IOException, 70 ::com::sun::star::uno::RuntimeException ); 71 72 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) 73 throw( ::com::sun::star::io::NotConnectedException, 74 ::com::sun::star::io::BufferSizeExceededException, 75 ::com::sun::star::io::IOException, 76 ::com::sun::star::uno::RuntimeException ); 77 78 virtual sal_Int32 SAL_CALL available( void ) 79 throw( ::com::sun::star::io::NotConnectedException, 80 ::com::sun::star::io::IOException, 81 ::com::sun::star::uno::RuntimeException ); 82 83 virtual void SAL_CALL closeInput( void ) 84 throw( ::com::sun::star::io::NotConnectedException, 85 ::com::sun::star::io::IOException, 86 ::com::sun::star::uno::RuntimeException ); 87 }; 88 89 } // namespace gio 90 #endif 91