22#include <com/sun/star/io/BufferSizeExceededException.hpp>
23#include <com/sun/star/io/NotConnectedException.hpp>
24#include <com/sun/star/io/XPipe.hpp>
25#include <com/sun/star/io/XConnectable.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
32#include <osl/conditn.hxx>
33#include <osl/mutex.hxx>
40using namespace ::
cppu;
54 public WeakImplHelper< XPipe , XConnectable , XServiceInfo >
60 virtual sal_Int32 SAL_CALL readBytes(
Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
override;
61 virtual sal_Int32 SAL_CALL readSomeBytes(
Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead)
override;
62 virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
override;
63 virtual sal_Int32 SAL_CALL available()
override;
64 virtual void SAL_CALL closeInput()
override;
69 virtual void SAL_CALL flush()
override;
70 virtual void SAL_CALL closeOutput()
override;
101OPipeImpl::OPipeImpl()
119 throw NotConnectedException(
120 "Pipe::readBytes NotConnectedException",
123 sal_Int32 nOccupiedBufferLen =
m_pFIFO->getSize();
127 nBytesToRead = nOccupiedBufferLen;
130 if( nOccupiedBufferLen < nBytesToRead )
137 m_pFIFO->read( aData , nBytesToRead );
155 throw NotConnectedException(
156 "Pipe::readSomeBytes NotConnectedException",
161 sal_Int32 nSize = std::min( nMaxBytesToRead ,
m_pFIFO->getSize() );
162 aData.realloc( nSize );
163 m_pFIFO->read( aData , nSize );
179void OPipeImpl::skipBytes(sal_Int32 nBytesToSkip)
184 throw NotConnectedException(
185 "Pipe::skipBytes NotConnectedException",
193 throw BufferSizeExceededException(
194 "Pipe::skipBytes BufferSizeExceededException",
205sal_Int32 OPipeImpl::available()
210 throw NotConnectedException(
211 "Pipe::available NotConnectedException",
217void OPipeImpl::closeInput()
238 throw NotConnectedException(
239 "Pipe::writeBytes NotConnectedException (outputstream)",
245 throw NotConnectedException(
246 "Pipe::writeBytes NotConnectedException (inputstream)",
251 sal_Int32 nLen =
aData.getLength();
276void OPipeImpl::flush()
281void OPipeImpl::closeOutput()
331OUString OPipeImpl::getImplementationName()
333 return "com.sun.star.comp.io.stm.Pipe";
337sal_Bool OPipeImpl::supportsService(
const OUString& ServiceName)
345 return {
"com.sun.star.io.Pipe" };
350extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
352 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
354 return cppu::acquire(
new io_stm::OPipeImpl());
constexpr OUStringLiteral aData
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Reference< XConnectable > m_succ
bool m_bInputStreamClosed
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * io_OPipeImpl_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
osl::Condition m_conditionBytesAvail
bool m_bOutputStreamClosed
Reference< XConnectable > m_pred
std::unique_ptr< MemFIFO > m_pFIFO