Coder Social home page Coder Social logo

lzstring4j's Introduction

lzstring4j - LZString for Java

lzstring4j is an easy to use implementation of JavaScript LZString Library for Java.

This idea is inspired by lz-string-java.

Features:

  • Based on latest version of JavaScript LZString Library (version 1.3.3)
  • UTF-16 compression
  • Interoperable with the JavaScript Library through the UTF-16 compression methods (Java Server -> JS on Web or Node.js server -> Java Client/Android) thanks to this post.

How to use

Using lzstring4j is quite simple. But lets see:

Checkout and compile the project:

git clone https://github.com/diogoduailibe/lzstring4j.git
cd lzstring4j
ant jar
mv jar/lzstring4j.jar /path/to/your/libs/project

If you're using ant, change your build.xml to include lzstring4j.jar. If you're eclipse, add the jar to your project buildpath.

Afterwards, you'll be able to use this library:

Normal Compression and Decompression:

	
	    // Normal Compression and Decompression
		String test = "Lets see how much we can compress this string!";

		String output = LZString.compress(test);

		System.out.println("Compressed: " + output);

		String decompressed = LZString.decompress(output);
		
		System.out.println("Decompressed: " + decompressed);

UTF-16 Compression and Decompression:

		//UTF-16 Compression and Decompression 
		String testUTF16 = "Lets see how much we can compress this string!";

		String outputUTF16 = LZString.compressToUTF16(testUTF16);

		System.out.println("Compressed: " + outputUTF16);

		String decompressedUTF16 = LZString.decompressFromUTF16(outputUTF16);
		
		System.out.println("Decompressed: " + decompressedUTF16);

Checkout

git clone https://github.com/diogoduailibe/lzstring4j.git

Building

to build a jar-file:

cd $PATH_TO_LZSTRING4J
ant jar
ls jar/lzstring4j.jar

You'll find the lzstring4j-jar in jar/lzstring4j.jar

Bugs

Please report any bugs feature requests to the Github issue tracker

Frameworks

This Library was designed with portability in mind.

  • Android is fully supported.
  • JRE is fully supported.

TODO

  • Implement base64 compression. (Base64 Decompression was implemented by helloanand. Thank's!)
  • More tests...

CONTRIBUTORS

License - the boring stuff...

See LICENSE file.

lzstring4j's People

Contributors

diogoduailibe avatar helloanand avatar

Watchers

James Cloos avatar Julien Morvan avatar

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.