Giter Club home page Giter Club logo

Comments (3)

gotson avatar gotson commented on May 30, 2024

It's not a bug, but a limitation from the library.

In order to read a RAR file, we need random access, as the headers are spread between the actual encoded files. To that end, when you create an Archive from an InputStream, junrar uses a RandomAccessInputStream (see here), which is backed by a memory cache.

You probably don't have enough memory for the cache of the RandomAccessInputStream to effectively store the 500mb of your file.

If you were to use Archive from a File, junrar would instead use RandomAccessFile, which wouldn't load the whole file in memory.

If you can switch to using a File instead of a InputStream, i would recommend you do so. From the sample code you provided, it seems you have a File already, so it should be easy to change.

from junrar.

WangWeiHuawwh avatar WangWeiHuawwh commented on May 30, 2024

The above code is just a Demo,Actually I only have uri parameter,and can only use uri conversion to InputStream to decompress. do you have a good ideal?

from junrar.

gotson avatar gotson commented on May 30, 2024

The only way would be to store the file on disk temporarily, and use a File thereafter.

Using a Uri and a stream would anyhow end up downloading the full file, so if you can download on disk instead of memory, that should work.

from junrar.

Related Issues (20)

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.