×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Text decompression on J2ME

    Does anyone have experience with compression/decompression on J2ME?

    I am currently writing a wikipedia dump reader, and it will surely need to be compressed (~12GB dump can be compressed down to ~2GB). What algorithms are available for J2ME?

    Other than availability, I think the main constraint would be memory usage, since my target phone only has 2MB memory available. Speed would not really be an issue because I can compress into small blocks (~1MB).

    I am currently thinking about bzip2 and 7z, since they sound like the best algorithms so far with decent compression ratio, low memory usage for decompression, and relatively fast decompression.

    I only need to decompress on the phone, no compression (will be done on a computer).

    What do you think?

    Many thanks

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Text decompression on J2ME

    The easiest option is just to ZLIB... that's how the JAR is compressed, and Class.getResourceAsStream() gives you access to a ZLIB decompressor.

    Strip out any extraneous junk from the data (like any formatting data that you won't honour on the device), and chunk it together. A small number of big files will give you better compression that a large number of small files.

    The alternative is to write your own decompressor. Or find one... I haven't seen to many decompressors in Java, but Google probably knows better than I.

    Your phone has 2Mb memory? Series 40? Are you sure it will take a 2Gb JAR?

    Cheers,
    Graham.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Text decompression on J2ME

    Thanks!

    The dump will be in a separate big file (accessed using FileConnection API) with all unnecessary formatting stripped.

    Since it will be in a different file, I'm guessing I cannot use Class.getResourceAsStream().

    I found a BZip2 implementation here -
    http://www.kohsuke.org/bzip2/

    But looking through its source, it seems like it will use quite a bit of memory.

    The LZMA SDK also has a Java implementation, but it has no documentation at all, and the sources aren't even commented...

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Text decompression on J2ME

    No, you can only use getResourceAsStream() to read from the class-path, which basically means from the JAR.

    I recommend you do some tests to ensure that you can open and read files of that size, before you do too much coding... :-) You might just find there are limitations that you don't expect.

    Cheers,
    Graham.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Text decompression on J2ME

    Ah okay, thanks!

Similar Threads

  1. TextWrapper example class
    By miohtama in forum Symbian
    Replies: 6
    Last Post: 2008-03-08, 11:46
  2. Exit form from edit mode
    By tqchcm in forum Symbian User Interface
    Replies: 13
    Last Post: 2007-10-31, 06:06
  3. Predictive text entry in j2me
    By jai99 in forum Mobile Java General
    Replies: 1
    Last Post: 2005-01-18, 14:04
  4. j2me phone can't able to read plain text from servlets - why?
    By mibuyt in forum Mobile Java General
    Replies: 5
    Last Post: 2003-09-29, 13:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×