pdjonov / lz4stream Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I'm uploading lz4 compressed files to our server, and when I am attempting to read them the stream has a very monstrous buffer that is not even remotely close to the size of the uncompressed file. We're on .NET 3.5, using C# for the code, so I had to tweak the Lz4DecoderStream.cs in order to have it work none of which should have affected the overall performance of the file, as all I changed was the generic vars to the appropriate variable type, and removed the optional setting for the inputs from long.maxlength, to requiring a size.
When I'm checking to detect if the lz4 file is appropriate, I do the following:
try
{
byte[] buffer = new byte[13];
//Gather the header information.
//Set the stream to the point of where the data starts, always the same with the way the compression is done.
int intRead = st.Read(buffer, 0, 13);
//Check if we have the magic number. Currently the value (in little endian) is 0x184D2204
if (buffer[3] == 0x18 && buffer[2] == 0x4D && buffer[1] == 0x22 && buffer[0] == 0x04)
{
//Use an input length of 14000 for testing purposes. Test files don't exceed this size.
using (Lz4.Lz4DecoderStream lzStream = new Lz4.Lz4DecoderStream(st, 14000))
{
DownloadCapture(szFileName, szConfig, dtFile, szZip, szExt, szDownload, bSort, lzStream, output);
}
}
}
The stream st is a memorystream of the data pulled from the database. Instead of the expected 14000 size buffer, I'm obtaining a 65664 sized buffer, where the first 65535 values are zero, before it actually starts at the position that the memorystream was left at intentionally. Interestingly, it starts right after the number set within the initialization of the DecBufMask value, but I'm having a difficult time following the Lz4DecoderStream code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.