[+] ICompressionStream::ToSeekingStreamReader

This commit is contained in:
Reece Wilson 2023-11-09 19:54:35 +00:00
parent 8624499ab8
commit 5e15cadce4
3 changed files with 19 additions and 1 deletions

View File

@ -7,6 +7,10 @@
***/
#pragma once
#include <Aurora/IO/EStreamError.hpp>
#include <Aurora/IO/IStreamReader.hpp>
#include <Aurora/IO/ISeekingReader.hpp>
namespace Aurora::Compression
{
struct ICompressionStream
@ -88,5 +92,11 @@ namespace Aurora::Compression
* @return
*/
virtual IO::IStreamReader *ToStreamReader() = 0;
/**
* @brief
* @return
*/
virtual IO::ISeekingReader *ToSeekingStreamReader() = 0;
};
}

View File

@ -232,4 +232,9 @@ namespace Aurora::Compression
{
return &this->reader_;
}
IO::ISeekingReader *BaseStream::ToSeekingStreamReader()
{
return &this->reader2_;
}
}

View File

@ -19,7 +19,8 @@ namespace Aurora::Compression
inline BaseStream(AuUInt32 bufferSize = 4096 * 64) :
_outbufferOwned(bufferSize, true),
uBufferSize_(bufferSize),
reader_(AuUnsafeRaiiToShared(this))
reader_(AuUnsafeRaiiToShared(this)),
reader2_(AuUnsafeRaiiToShared(this))
{
SetBuffer({});
}
@ -55,6 +56,7 @@ namespace Aurora::Compression
virtual bool Finish() override;
virtual IO::IStreamReader *ToStreamReader() override;
virtual IO::ISeekingReader *ToSeekingStreamReader() override;
bool IsValid();
@ -70,6 +72,7 @@ namespace Aurora::Compression
protected:
virtual AuStreamReadWrittenPair_t Ingest_s(AuUInt32 dwBytesFromUnprocessedInputSource) = 0;
IO::Adapters::CompressionStreamReader reader_;
IO::Adapters::CompressionSeekingReader reader2_;
AuSPtr<Memory::ByteBuffer> pOutputBuffer_;
AuWPtr<Memory::ByteBuffer> wpInBuffer_;
AuSPtr<AuIO::IStreamWriter> pOutputBufferInterface_;