diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-01-11 17:39:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 17:39:43 +0100 |
commit | eeb63b8901a9c049f1bb594abb9ce9b4a9c47620 (patch) | |
tree | b07daae788f918b83eeb0bdbd51e49292f1c8d88 /src/CircularBufferCompressor.cpp | |
parent | Fixed switch-ups regarding some slab and stair recipes (#5099) (diff) | |
download | cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.gz cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.bz2 cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.lz cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.xz cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.zst cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.zip |
Diffstat (limited to 'src/CircularBufferCompressor.cpp')
-rw-r--r-- | src/CircularBufferCompressor.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/CircularBufferCompressor.cpp b/src/CircularBufferCompressor.cpp new file mode 100644 index 000000000..823dd8862 --- /dev/null +++ b/src/CircularBufferCompressor.cpp @@ -0,0 +1,67 @@ + +#include "Globals.h" +#include "CircularBufferCompressor.h" +#include "ByteBuffer.h" + + + + + +ContiguousByteBufferView CircularBufferCompressor::GetView() const +{ + return m_ContiguousIntermediate; +} + + + + + +Compression::Result CircularBufferCompressor::Compress() +{ + return m_Compressor.CompressZLib(m_ContiguousIntermediate); +} + + + + + +void CircularBufferCompressor::ReadFrom(cByteBuffer & Buffer) +{ + Buffer.ReadAll(m_ContiguousIntermediate); +} + + + + + +void CircularBufferCompressor::ReadFrom(cByteBuffer & Buffer, size_t Size) +{ + Buffer.ReadSome(m_ContiguousIntermediate, Size); +} + + + + + +ContiguousByteBufferView CircularBufferExtractor::GetView() const +{ + return m_ContiguousIntermediate; +} + + + + + +Compression::Result CircularBufferExtractor::Extract(size_t UncompressedSize) +{ + return m_Extractor.ExtractZLib(m_ContiguousIntermediate, UncompressedSize); +} + + + + + +void CircularBufferExtractor::ReadFrom(cByteBuffer & Buffer, size_t Size) +{ + Buffer.ReadSome(m_ContiguousIntermediate, Size); +} |