summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
Diffstat (limited to 'ucb')
-rw-r--r--ucb/Library_ucpfile1.mk1
-rw-r--r--ucb/source/ucp/file/filstr.cxx23
-rw-r--r--ucb/source/ucp/file/filstr.hxx15
3 files changed, 38 insertions, 1 deletions
diff --git a/ucb/Library_ucpfile1.mk b/ucb/Library_ucpfile1.mk
index 2f9684955ec5..f67c69b78b28 100644
--- a/ucb/Library_ucpfile1.mk
+++ b/ucb/Library_ucpfile1.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_Library_use_libraries,ucpfile1,\
sal \
tl \
ucbhelper \
+ utl \
))
$(eval $(call gb_Library_add_exception_objects,ucpfile1,\
diff --git a/ucb/source/ucp/file/filstr.cxx b/ucb/source/ucp/file/filstr.cxx
index 8b4274cb60e0..8e605f7f1cc6 100644
--- a/ucb/source/ucp/file/filstr.cxx
+++ b/ucb/source/ucp/file/filstr.cxx
@@ -148,6 +148,29 @@ XStream_impl::readBytes(
return static_cast<sal_Int32>(nrc);
}
+sal_Int32
+XStream_impl::readSomeBytes(
+ sal_Int8* pData,
+ sal_Int32 nBytesToRead )
+{
+ if( ! m_nIsOpen )
+ throw io::IOException( THROW_WHERE );
+
+ sal_uInt64 nrc(0);
+ if(m_aFile.read( pData, sal_uInt64(nBytesToRead), nrc )
+ != osl::FileBase::E_None)
+ {
+ throw io::IOException( THROW_WHERE );
+ }
+ return static_cast<sal_Int32>(nrc);
+}
+
+sal_Int64 SAL_CALL XStream_impl::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier )
+{
+ if (rIdentifier == utl::ByteReader::getUnoTunnelId())
+ return reinterpret_cast<sal_Int64>(static_cast<utl::ByteReader*>(this));
+ return 0;
+}
sal_Int32 SAL_CALL
XStream_impl::readSomeBytes(
diff --git a/ucb/source/ucp/file/filstr.hxx b/ucb/source/ucp/file/filstr.hxx
index ad6c39964448..65cf4369ce75 100644
--- a/ucb/source/ucp/file/filstr.hxx
+++ b/ucb/source/ucp/file/filstr.hxx
@@ -25,7 +25,9 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XAsyncOutputMonitor.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/implbase.hxx>
+#include <unotools/bytereader.hxx>
#include <mutex>
#include "filrec.hxx"
@@ -41,7 +43,9 @@ class XStream_impl : public cppu::WeakImplHelper<
css::io::XInputStream,
css::io::XOutputStream,
css::io::XTruncate,
- css::io::XAsyncOutputMonitor >
+ css::io::XAsyncOutputMonitor,
+ css::lang::XUnoTunnel >,
+ public utl::ByteReader
{
public:
@@ -120,6 +124,15 @@ class XStream_impl : public cppu::WeakImplHelper<
virtual void SAL_CALL waitForCompletion() override;
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
+
+ // utl::ByteReader
+ virtual sal_Int32
+ readSomeBytes(
+ sal_Int8* aData,
+ sal_Int32 nMaxBytesToRead ) override;
+
private:
std::mutex m_aMutex;