This repository has been archived on 2026-05-14. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
MinecraftConsoles/Minecraft.World/ByteArrayOutputStream.h
2026-03-01 12:16:08 +08:00

29 lines
730 B
C++

#pragma once
#include "OutputStream.h"
class ByteArrayOutputStream : public OutputStream
{
// Note - when actually implementing, byteArray will need to grow as data is written
public:
byteArray buf; //The buffer where data is stored.
protected:
unsigned int count; //The number of valid bytes in the buffer.
public:
ByteArrayOutputStream();
ByteArrayOutputStream(unsigned int size);
virtual ~ByteArrayOutputStream();
virtual void flush() {}
virtual void write(unsigned int b);
virtual void write(byteArray b);
virtual void write(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual byteArray toByteArray();
void reset() { count = 0; }
unsigned int size() { return count; }
};