12#include <com/sun/star/io/IOException.hpp>
13#include <com/sun/star/lang/IllegalArgumentException.hpp>
31 m_pStream->seekg( 0, std::ios_base::end );
33 m_pStream->seekg( nInitPos, std::ios_base::beg );
35 m_nLength = sal_Int64( nEndPos - nInitPos );
45 uno::Any aRet = ::cppu::queryInterface( rType,
46 static_cast< XInputStream*
>(
this ),
47 static_cast< XSeekable*
>(
this ) );
49 return aRet.
hasValue() ? aRet : OWeakObject::queryInterface( rType );
54 OWeakObject::acquire();
59 OWeakObject::release();
66 if ( 0 <= nBytesToRead &&
aData.getLength() < nBytesToRead )
67 aData.realloc( nBytesToRead );
70 throw io::IOException( );
75 m_pStream->read(
reinterpret_cast< char*
>(
aData.getArray( ) ), nBytesToRead );
78 catch (
const std::ios_base::failure& e )
80 SAL_INFO(
"ucb.ucp.cmis",
"StdInputStream::readBytes() error: " << e.what() );
81 throw io::IOException( );
88 sal_Int32 nMaxBytesToRead )
92 if ( 0 <= nMaxBytesToRead &&
aData.getLength() < nMaxBytesToRead )
93 aData.realloc( nMaxBytesToRead );
96 throw io::IOException( );
101 nRead =
m_pStream->readsome(
reinterpret_cast< char*
>(
aData.getArray( ) ), nMaxBytesToRead );
103 catch (
const std::ios_base::failure& e )
105 SAL_INFO(
"ucb.ucp.cmis",
"StdInputStream::readBytes() error: " << e.what() );
106 throw io::IOException( );
113 std::scoped_lock aGuard(
m_aMutex );
116 throw io::IOException( );
120 m_pStream->seekg( nBytesToSkip, std::ios_base::cur );
122 catch (
const std::ios_base::failure& e )
124 SAL_INFO(
"ucb.ucp.cmis",
"StdInputStream::readBytes() error: " << e.what() );
125 throw io::IOException( );
141 std::scoped_lock aGuard(
m_aMutex );
143 if ( location < 0 || location >
m_nLength )
144 throw lang::IllegalArgumentException(
145 "Location can't be negative or greater than the length",
149 throw io::IOException( );
154 m_pStream->seekg( location, std::ios_base::beg );
156 catch (
const std::ios_base::failure& e )
158 SAL_INFO(
"ucb.ucp.cmis",
"StdInputStream::readBytes() error: " << e.what() );
159 throw io::IOException( );
165 std::scoped_lock aGuard(
m_aMutex );
168 throw io::IOException( );
172 throw io::IOException( );
const sal_Int32 m_nLength
GtkMediaStream * m_pStream
#define SAL_INFO(area, stream)
constexpr OUStringLiteral aData