| Crates.io | lz4-java-wrc |
| lib.rs | lz4-java-wrc |
| version | 0.2.0 |
| created_at | 2024-02-16 04:09:54.198252+00 |
| updated_at | 2024-02-16 04:09:54.198252+00 |
| description | A fork of `lz4jb` to ensure it gives back access to the underlying writer (wrc = "write continue") `lz4jb` is a Rust implementation of the LZ4BlockOutputStream format from https://github.com/lz4/lz4-java. This is not compatible with the standard LZ4 Block format, and is useful for reading Minecraft region files. |
| homepage | https://github.com/lordofpipes/lz4-java-wrc |
| repository | https://github.com/lordofpipes/lz4-java-wrc |
| max_upload_size | |
| id | 1142062 |
| size | 58,516 |
This is a fork of lz4jb that accepts the writer as a pointer instead of consuming it.
A streaming compression/decompression library which implements the LZ4BlockOutputStream format from lz4-java.
Beware: this format is not compatible with the standard LZ4 Block format. The Minecraft 1.20.5 lz4 chunk compression format is an example of a place this is used.
This repository contains:
lz4_java_wrc: a library which implements the Read and Write traits,Add this to your Cargo.toml:
[dependencies]
lz4-java-wrc = "0.2.0"
Lz4BlockOutput is a wrapper around a type which implements the Write trait.
use lz4_java_wrc::Lz4BlockOutput;
use std::io::Write;
fn main() -> std::io::Result<()> {
let mut output = Vec::new(); // Vec<u8> implements the Write trait
Lz4BlockOutput::new(&mut output, 64)?
.write_all("...".as_bytes())?;
println!("{:?}", output);
Ok(())
}
Lz4BlockInput is a wrapper around a type which implements the Read trait.
use lz4_java_wrc::Lz4BlockInput;
use std::io::Read;
const D: [u8; 24] = [
76, 90, 52, 66, 108, 111, 99, 107, 16, 3, 0, 0, 0, 3, 0, 0, 0, 82, 228, 119, 6, 46, 46, 46,
];
fn main() -> std::io::Result<()> {
let mut output = String::new();
Lz4BlockInput::new(&D[..]) // &[u8] implements the Read trait
.read_to_string(&mut output)?;
println!("{}", output);
Ok(())
}
See the LICENCE file.