add skipBytes function to InStream

this reads N bytes, discarding their values
master
dbandstra 2018-07-28 17:34:28 -07:00
parent 3ce0ea884f
commit f36faa32c4
1 changed files with 7 additions and 0 deletions

View File

@ -200,6 +200,13 @@ pub fn InStream(comptime ReadError: type) type {
try self.readNoEof(input_slice); try self.readNoEof(input_slice);
return mem.readInt(input_slice, T, endian); 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();
}
}
}; };
} }