Buffer.readVar

Reads a varint.

class Buffer
pure @safe
T
readVar
(
T
)
()
if (
isIntegral!T &&
T.sizeof > 1
)

Throws

BufferOverflowException if there isn't enough data to read.

Examples

t {
		
		import xbuffer.varint;
		
		Buffer buffer = new Buffer(cast(ubyte[])[2, 1]);
		assert(buffer.readVar!int() == 1);
		assert(buffer.read!varuint() == 1);
	

Meta