From f36faa32c46897a12852da9f382ab10979511d6f Mon Sep 17 00:00:00 2001 From: dbandstra Date: Sat, 28 Jul 2018 17:34:28 -0700 Subject: [PATCH] add skipBytes function to InStream this reads N bytes, discarding their values --- std/io.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/std/io.zig b/std/io.zig index 1b1c56b69..5d73b4e7d 100644 --- a/std/io.zig +++ b/std/io.zig @@ -200,6 +200,13 @@ pub fn InStream(comptime ReadError: type) type { try self.readNoEof(input_slice); return mem.readInt(input_slice, T, endian); } + + pub fn skipBytes(self: *Self, num_bytes: usize) !void { + var i: usize = 0; + while (i < num_bytes) : (i += 1) { + _ = try self.readByte(); + } + } }; }