22#include <com/sun/star/io/IOException.hpp>
23#include <com/sun/star/io/NotConnectedException.hpp>
35 throw css::io::NotConnectedException();
45 throw css::io::NotConnectedException();
47 if (!g_seekable_can_truncate(
mpStream))
48 throw css::io::IOException(
"Truncate unsupported",
51 GError *pError=
nullptr;
52 if (!g_seekable_truncate(
mpStream, 0,
nullptr, &pError))
59 throw css::io::NotConnectedException();
62 throw css::io::IOException(
"Seek unsupported",
65 GError *pError=
nullptr;
66 if (!g_seekable_seek(
mpStream, location, G_SEEK_SET,
nullptr, &pError))
73 throw css::io::NotConnectedException();
81 throw css::io::NotConnectedException();
86 GFileInfo* pInfo = G_IS_FILE_INPUT_STREAM(
mpStream)
87 ? g_file_input_stream_query_info(G_FILE_INPUT_STREAM(
mpStream), G_FILE_ATTRIBUTE_STANDARD_SIZE,
nullptr,
nullptr)
88 : g_file_output_stream_query_info(G_FILE_OUTPUT_STREAM(
mpStream), G_FILE_ATTRIBUTE_STANDARD_SIZE,
nullptr,
nullptr);
92 if (g_file_info_has_attribute(pInfo, G_FILE_ATTRIBUTE_STANDARD_SIZE))
94 nSize = g_file_info_get_size(pInfo);
97 g_object_unref(pInfo);
102 GError *pError=
nullptr;
104 if (!g_seekable_seek(
mpStream, 0, G_SEEK_END,
nullptr, &pError))
115 css::uno::Any aRet = ::cppu::queryInterface (
type,
116 static_cast< XSeekable *
>(
this ) );
118 if (!aRet.hasValue() && g_seekable_can_truncate(
mpStream))
119 aRet = ::cppu::queryInterface (
type,
static_cast< XTruncate *
>(
this ) );
121 return aRet.hasValue() ? aRet : OWeakObject::queryInterface(
type );
virtual sal_Int64 SAL_CALL getLength() override
virtual ~Seekable() override
Seekable(GSeekable *pStream)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &type) override
virtual sal_Int64 SAL_CALL getPosition() override
virtual void SAL_CALL seek(sal_Int64 location) override
virtual void SAL_CALL truncate() override
void convertToIOException(GError *pError, const css::uno::Reference< css::uno::XInterface > &rContext)