mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:07:34 +00:00
AK: Move memory streams from LibCore
This commit is contained in:
parent
11550f582b
commit
093cf428a3
46 changed files with 213 additions and 203 deletions
|
@ -10,7 +10,7 @@
|
|||
#include <AK/BinaryHeap.h>
|
||||
#include <AK/BinarySearch.h>
|
||||
#include <AK/BitStream.h>
|
||||
#include <LibCore/MemoryStream.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <LibCompress/Deflate.h>
|
||||
|
@ -317,9 +317,9 @@ void DeflateDecompressor::close()
|
|||
|
||||
ErrorOr<ByteBuffer> DeflateDecompressor::decompress_all(ReadonlyBytes bytes)
|
||||
{
|
||||
auto memory_stream = TRY(Core::Stream::FixedMemoryStream::construct(bytes));
|
||||
auto memory_stream = TRY(FixedMemoryStream::construct(bytes));
|
||||
auto deflate_stream = TRY(DeflateDecompressor::construct(move(memory_stream)));
|
||||
Core::Stream::AllocatingMemoryStream output_stream;
|
||||
AllocatingMemoryStream output_stream;
|
||||
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||
while (!deflate_stream->is_eof()) {
|
||||
|
@ -1017,7 +1017,7 @@ ErrorOr<void> DeflateCompressor::final_flush()
|
|||
|
||||
ErrorOr<ByteBuffer> DeflateCompressor::compress_all(ReadonlyBytes bytes, CompressionLevel compression_level)
|
||||
{
|
||||
auto output_stream = TRY(try_make<Core::Stream::AllocatingMemoryStream>());
|
||||
auto output_stream = TRY(try_make<AllocatingMemoryStream>());
|
||||
auto deflate_stream = TRY(DeflateCompressor::construct(MaybeOwned<AK::Stream>(*output_stream), compression_level));
|
||||
|
||||
TRY(deflate_stream->write_entire_buffer(bytes));
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <LibCompress/Gzip.h>
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/MemoryStream.h>
|
||||
|
||||
namespace Compress {
|
||||
|
||||
|
@ -164,9 +164,9 @@ Optional<DeprecatedString> GzipDecompressor::describe_header(ReadonlyBytes bytes
|
|||
|
||||
ErrorOr<ByteBuffer> GzipDecompressor::decompress_all(ReadonlyBytes bytes)
|
||||
{
|
||||
auto memory_stream = TRY(Core::Stream::FixedMemoryStream::construct(bytes));
|
||||
auto memory_stream = TRY(FixedMemoryStream::construct(bytes));
|
||||
auto gzip_stream = make<GzipDecompressor>(move(memory_stream));
|
||||
Core::Stream::AllocatingMemoryStream output_stream;
|
||||
AllocatingMemoryStream output_stream;
|
||||
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||
while (!gzip_stream->is_eof()) {
|
||||
|
@ -235,7 +235,7 @@ void GzipCompressor::close()
|
|||
|
||||
ErrorOr<ByteBuffer> GzipCompressor::compress_all(ReadonlyBytes bytes)
|
||||
{
|
||||
auto output_stream = TRY(try_make<Core::Stream::AllocatingMemoryStream>());
|
||||
auto output_stream = TRY(try_make<AllocatingMemoryStream>());
|
||||
GzipCompressor gzip_stream { MaybeOwned<AK::Stream>(*output_stream) };
|
||||
|
||||
TRY(gzip_stream.write_entire_buffer(bytes));
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
*/
|
||||
|
||||
#include <AK/IntegralMath.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <AK/Span.h>
|
||||
#include <AK/TypeCasts.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibCompress/Deflate.h>
|
||||
#include <LibCompress/Zlib.h>
|
||||
#include <LibCore/MemoryStream.h>
|
||||
|
||||
namespace Compress {
|
||||
|
||||
|
@ -163,7 +163,7 @@ ErrorOr<void> ZlibCompressor::finish()
|
|||
|
||||
ErrorOr<ByteBuffer> ZlibCompressor::compress_all(ReadonlyBytes bytes, ZlibCompressionLevel compression_level)
|
||||
{
|
||||
auto output_stream = TRY(try_make<Core::Stream::AllocatingMemoryStream>());
|
||||
auto output_stream = TRY(try_make<AllocatingMemoryStream>());
|
||||
auto zlib_stream = TRY(ZlibCompressor::construct(MaybeOwned<AK::Stream>(*output_stream), compression_level));
|
||||
|
||||
TRY(zlib_stream->write_entire_buffer(bytes));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue