Commit f36faa32c4

dbandstra <dbandstra@protonmail.com>
2018-07-29 02:34:28
add skipBytes function to InStream
this reads N bytes, discarding their values
1 parent 3ce0ea8
Changed files (1)
std
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();
+            }
+        }
     };
 }