Readbuffer class

A high-performance buffer for reading binary data from Mapsforge files.

This class provides efficient methods for reading various data types from binary streams, with optimizations for variable-length integer encoding and UTF-8 string decoding commonly used in Mapsforge format.

Key features:

  • Big-endian byte order for all multi-byte values
  • Variable-length integer encoding support
  • Optimized UTF-8 string decoding with caching
  • Tag parsing for map metadata
  • Memory-efficient buffer management

Constructors

Readbuffer(Uint8List _bufferData, int? _offset)
Creates a new Readbuffer with the given data and optional file offset.
Readbuffer.from(Readbuffer other)
Creates a new Readbuffer by copying the given buffer and setting the new buffer position to 0.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getBuffer(int position, int length) Uint8List
Extracts a portion of the buffer as a new Uint8List.
getBufferPosition() int
Gets the current read position in the buffer.
getBufferSize() int
Gets the total size of the buffer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readByte() int
Reads one signed byte from the current buffer position.
readFloat() double
Reads a 32-bit IEEE 754 float from the current buffer position.
readInt() int
Reads a 32-bit signed integer from the current buffer position.
readLong() int
Reads a 64-bit signed integer from the current buffer position.
readShort() int
Reads a 16-bit signed integer from the current buffer position.
readSignedInt() int
Reads a variable-length signed integer using modified LEB128 encoding.
readTags(List<Tag> tagsArray, int numberOfTags) List<Tag>
Reads and parses map tags from the buffer.
readUnsignedInt() int
Reads a variable-length unsigned integer using LEB128 encoding.
readUTF8EncodedString() String
Reads a UTF-8 encoded string with variable length prefix.
readUTF8EncodedString2(int stringLength) String
Reads a UTF-8 encoded string of specified length.
setBufferPosition(int bufferPosition) → void
Sets the current read position in the buffer.
skipBytes(int bytes) → void
Advances the buffer position by the specified number of bytes.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

CHARSET_UTF8 String
final