|
Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
|
A stream from Memory. More...
#include <stream.h>
Public Member Functions | |
| MemoryStream ()=default | |
| Construct a new Memory Stream object. | |
| ~MemoryStream () override=default | |
| Destroy the Memory Stream object. | |
| void | read (std::byte *buffer, std::size_t offset, std::size_t len) override |
| Reads from the stream. | |
| void | write (const std::byte *buffer, std::size_t offset, std::size_t len) override |
| Writes to the stream. | |
| void | flush () override |
| Flushes the stream. | |
| size_t | available () override |
| Gets the number of available bytes. | |
| void | finishPacketWrite (const std::byte *packetData, size_t len) override |
| Finishes to write the packet in a Minecrafty way. | |
| void | clear () |
| Cleares the stream. | |
| const std::vector< std::byte > & | getData () const |
| Get the written data. | |
Public Member Functions inherited from IMCStream | |
| bool | readBoolean () |
| Reads a Boolean. | |
| void | writeBoolean (bool b) |
| Writes a Boolean. | |
| std::int8_t | readByte () |
| Reads a Byte. | |
| void | writeByte (std::int8_t b) |
| Writes a Byte. | |
| std::uint8_t | readUnsignedByte () |
| Reads an Unsigned Byte. | |
| void | writeUnsignedByte (std::uint8_t b) |
| Writes an Unsigned Byte. | |
| std::int16_t | readShort () |
| Reads a Short. | |
| void | writeShort (std::int16_t s) |
| Writes a Short. | |
| std::uint16_t | readUnsignedShort () |
| Reads an Unsigned Short. | |
| void | writeUnsignedShort (std::uint16_t s) |
| Writes an Unsigned short. | |
| std::int32_t | readInt () |
| Reads an Integer. | |
| void | writeInt (std::int32_t i) |
| Writes a Integer. | |
| std::int64_t | readLong () |
| Reads a Long. | |
| void | writeLong (std::int64_t l) |
| Writes a Long. | |
| float | readFloat () |
| Reads a Float. | |
| void | writeFloat (float f) |
| Writes a Float. | |
| double | readDouble () |
| Reads a Double. | |
| void | writeDouble (double d) |
| Writes a Double. | |
| std::string | readString () |
| Reads a String. | |
| void | writeString (const std::string &s) |
| Writes a String. | |
| ChatMessage | readChat () |
| Reads a Chat Message. | |
| void | writeChat (const ChatMessage &c) |
| Writes a Chat Message. | |
| std::int32_t | readVarInt () |
| Reads a Variable Integer. | |
| void | writeVarInt (std::int32_t i) |
| Writes a Variable Integer. | |
| std::int64_t | readVarLong () |
| Reads a Variable Long. | |
| void | writeVarLong (std::int64_t l) |
| Writes a Variable Long. | |
| MinecraftUUID | readUUID () |
| Reads an MinecraftUUID. | |
| void | writeUUID (const MinecraftUUID &uuid) |
| Writes an MinecraftUUID. | |
A stream from Memory.
A simple wrapper, mainly used for buffering to use a stream on memory, with variable size using a vector. Constructed like a passthrough stream : you read and write to the same buffer.
|
overridevirtual |
Gets the number of available bytes.
Implements IMCStream.
| void MemoryStream::clear | ( | ) |
Cleares the stream.
Cleares the stream of any data.
Finishes to write the packet in a Minecrafty way.
| packetData | the packet data |
| len | the length of the packet data |
Implements IMCStream.
|
overridevirtual |
Flushes the stream.
Flushes the buffer of the stream, resetting the index of the buffer.
Implements IMCStream.
| const std::vector< std::byte > & MemoryStream::getData | ( | ) | const |
Get the written data.
Gets the written data of the buffer, excluding any index.
|
overridevirtual |
Reads from the stream.
Reads from the memory buffer of the stream.
| buffer | the buffer to write to |
| offset | the offset to start writing at |
| len | the maximum length to write |
Implements IMCStream.
|
overridevirtual |
Writes to the stream.
Writes to the memory of the stream, appending it.
| buffer | the buffer to read from |
| offset | the offset to start reading from |
| len | the maximum read length |
Implements IMCStream.