class Yuno::VgmDecompressor
- Yuno::VgmDecompressor
- Reference
- Object
Overview
Detects and decompresses VGM streams. This is designed so that external libraries can extend the functionality of this class without needing to reopen it.
Defined in:
yunosynth/vgmdecompressor.crClass Method Summary
-
.funcs
The set of all
FuncSets that can be used to check for compressed data, and decompress it. -
.getHint(filename : String | Path) : Symbol | Nil
Looks at the extension of
filenameand attempts to guess the compression method (if any). -
.isBz2?(io : IO) : Bool
Returns
trueifiocontains BZip2 data, orfalseotherwise. -
.isGz?(io : IO) : Bool
Returns
trueifiocontains GZipped data, orfalseotherwise. -
.isZstd?(io : IO) : Bool
Returns
trueifiocontains ZStandard data, orfalseotherwise. -
.maybeDecompress(io : IO, hint : Symbol | Nil = nil) : IO
Checks to see if
ioneeds to be decompressed. -
.registerFunctions(ident : Symbol, extensions : Array(String), checkFn : CheckerFn, decompFn : DecompFn) : Nil
Registers a new method for checking for compressed data, and decompressing that data.
-
.unbzip2(io : IO) : IO::Memory
Decompresses
iointo anIO::Memory, then returns the new IO. -
.ungz(io : IO) : IO::Memory
Decompresses
iointo anIO::Memory, then returns the new IO. -
.unzstd(io : IO) : IO::Memory
Decompresses
iointo anIO::Memory, then returns the new IO.
Class Method Detail
The set of all FuncSets that can be used to check for compressed data,
and decompress it.
Looks at the extension of filename and attempts to guess the compression
method (if any). This will return a Symbol if it was able to guess, or
nil otherwise.
The symbol return will reference one of the known compression methods in
#funcs. This symbol can then be passed to #maybeDecompress.
This returns nil if it thinks that filename is an uncompressed VGM.
Returns true if io contains BZip2 data, or false otherwise. This
requires io to support IO#pos=.
Returns true if io contains GZipped data, or false otherwise. This
requires io to support IO#pos=.
Returns true if io contains ZStandard data, or false otherwise. This
requires io to support IO#pos=.
Checks to see if io needs to be decompressed. If it does, this
decompresses the stream into RAM. This then returns an IO that can be
used to read uncompressed data, which may be the original IO if it was not
compressed. io must support IO#pos.
If hint is provided and is a known decompression scheme found in
#funcs, then that scheme will be tried first to offer a speedup in load
times. You can get a hint by using #getHint.
Registers a new method for checking for compressed data, and decompressing
that data. ident can be used to reference the FuncSet from #funcs
after registering. extension is a set of file extensions that can be
used by #getHint for this compression scheme. The extension should
include the period and should be entirely lowercase, e.g. ".vgz".
Note that ident cannot be :none.
Decompresses io into an IO::Memory, then returns the new IO.
Decompresses io into an IO::Memory, then returns the new IO.