Function decompress [src]

Prototype

pub fn decompress( self: *Decoder, allocator: Allocator, reader: anytype, writer: anytype, ) !void

Parameters

self: *Decoderallocator: Allocator

Source

pub fn decompress( self: *Decoder, allocator: Allocator, reader: anytype, writer: anytype, ) !void { var accum = LzAccumBuffer.init(std.math.maxInt(usize)); defer accum.deinit(allocator); while (true) { const status = try reader.readByte(); switch (status) { 0 => break, 1 => try parseUncompressed(allocator, reader, writer, &accum, true), 2 => try parseUncompressed(allocator, reader, writer, &accum, false), else => try self.parseLzma(allocator, reader, writer, &accum, status), } } try accum.finish(writer); }