Code Monkey home page Code Monkey logo

lz4stream's People

Contributors

pdjonov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lz4stream's Issues

Issue with Lz4DecoderStream

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.