|
|
@ -34,12 +34,12 @@ impl BDFWriter {
|
|
|
|
/// bar for how many entries were read.
|
|
|
|
/// bar for how many entries were read.
|
|
|
|
/// If the `compress` parameter is true, each data chunk will be compressed
|
|
|
|
/// If the `compress` parameter is true, each data chunk will be compressed
|
|
|
|
/// using lzma with a default level of 1.
|
|
|
|
/// using lzma with a default level of 1.
|
|
|
|
pub fn new(writer: BufWriter<File>, entry_count: u64, compress: bool) -> Self {
|
|
|
|
pub fn new(inner: File, entry_count: u64, compress: bool) -> Self {
|
|
|
|
Self {
|
|
|
|
Self {
|
|
|
|
metadata: MetaChunk::new(entry_count, ENTRIES_PER_CHUNK, compress),
|
|
|
|
metadata: MetaChunk::new(entry_count, ENTRIES_PER_CHUNK, compress),
|
|
|
|
lookup_table: HashLookupTable::new(HashMap::new()),
|
|
|
|
lookup_table: HashLookupTable::new(HashMap::new()),
|
|
|
|
data_entries: Vec::new(),
|
|
|
|
data_entries: Vec::new(),
|
|
|
|
writer,
|
|
|
|
writer: BufWriter::new(inner),
|
|
|
|
head_written: false,
|
|
|
|
head_written: false,
|
|
|
|
compressed: compress,
|
|
|
|
compressed: compress,
|
|
|
|
compression_level: 1,
|
|
|
|
compression_level: 1,
|
|
|
@ -134,11 +134,11 @@ impl BDFWriter {
|
|
|
|
|
|
|
|
|
|
|
|
impl BDFReader {
|
|
|
|
impl BDFReader {
|
|
|
|
/// Creates a new BDFReader
|
|
|
|
/// Creates a new BDFReader
|
|
|
|
pub fn new(reader: BufReader<File>) -> Self {
|
|
|
|
pub fn new(inner: File) -> Self {
|
|
|
|
Self {
|
|
|
|
Self {
|
|
|
|
metadata: None,
|
|
|
|
metadata: None,
|
|
|
|
lookup_table: None,
|
|
|
|
lookup_table: None,
|
|
|
|
reader,
|
|
|
|
reader: BufReader::new(inner),
|
|
|
|
compressed: false,
|
|
|
|
compressed: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -226,6 +226,7 @@ impl BDFReader {
|
|
|
|
data,
|
|
|
|
data,
|
|
|
|
crc,
|
|
|
|
crc,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if gen_chunk.name == DTBL_CHUNK_NAME.to_string() && self.compressed {
|
|
|
|
if gen_chunk.name == DTBL_CHUNK_NAME.to_string() && self.compressed {
|
|
|
|
gen_chunk.decompress()?;
|
|
|
|
gen_chunk.decompress()?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|