23#include <com/sun/star/io/IOException.hpp>
24#include <com/sun/star/lang/IllegalArgumentException.hpp>
32XInputStream_impl::XInputStream_impl(
const OUString& aUncPath )
36 m_bIsOpen = ( osl::FileBase::E_None ==
m_aFile.open( osl_File_OpenFlag_Read ) );
49 static_cast< io::XInputStream*
>(
this),
50 static_cast< io::XSeekable*
>(
this) );
51 return aRet.
hasValue() ? aRet : OWeakObject::queryInterface( rType );
59 OWeakObject::acquire();
67 OWeakObject::release();
73 uno::Sequence< sal_Int8 >& aData,
74 sal_Int32 nBytesToRead )
77 throw io::IOException();
79 if (
aData.getLength() < nBytesToRead)
80 aData.realloc(nBytesToRead);
84 sal_uInt64 nBytesRead;
85 m_aFile.read(
aData.getArray(), sal_uInt64(nBytesToRead), nBytesRead );
90 if (nBytesRead != sal::static_int_cast<sal_uInt64>(nBytesToRead) )
91 aData.realloc(sal_Int32(nBytesRead));
92 return static_cast<sal_Int32
>(nBytesRead);
97 uno::Sequence< sal_Int8 >& aData,
98 sal_Int32 nMaxBytesToRead )
100 return readBytes( aData,nMaxBytesToRead );
106 sal_Int32 nBytesToSkip )
108 if (
m_aFile.setPos(osl_Pos_Current, sal_uInt64(nBytesToSkip)) != osl::FileBase::E_None)
110 throw io::IOException(
"XInputStream_impl::skipBytes failed seek");
119 if( osl::FileBase::E_None !=
m_aFile.getPos( uPos ) )
120 throw io::IOException();
122 if( osl::FileBase::E_None !=
m_aFile.getSize( uSize ) )
123 throw io::IOException();
134 if(
err != osl::FileBase::E_None )
135 throw io::IOException();
145 throw lang::IllegalArgumentException();
146 if( osl::FileBase::E_None !=
m_aFile.setPos( osl_Pos_Absolut, sal_uInt64( location ) ) )
147 throw io::IOException();
155 if( osl::FileBase::E_None !=
m_aFile.getPos( uPos ) )
156 throw io::IOException();
157 return sal_Int64( uPos );
163 osl::FileBase::RC
err;
164 sal_uInt64 uCurrentPos, uEndPos;
167 if(
err != osl::FileBase::E_None )
168 throw io::IOException();
171 if(
err != osl::FileBase::E_None )
172 throw io::IOException();
175 if(
err != osl::FileBase::E_None )
176 throw io::IOException();
178 err =
m_aFile.setPos( osl_Pos_Absolut, uCurrentPos );
179 if(
err != osl::FileBase::E_None )
180 throw io::IOException();
182 return sal_Int64( uEndPos );
constexpr OUStringLiteral aData
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)