Skip to content

Commit 1f73c8f

Browse files
committed
Fixes issue 26. Add note on using configuration file and license of the embedded libstdc++ library (GCC Runtime Library Exception)
1 parent 29753d9 commit 1f73c8f

File tree

3 files changed

+44
-39
lines changed

3 files changed

+44
-39
lines changed

INSTALL

+15-1
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,25 @@ $ make native
5454
$ make clean-native native
5555

5656

57-
= Using system installed libsnappyjava (or snappyjava.dll)
57+
= Using system installed libsnappyjava (or snappyjava.dll) =
5858

5959
Set org.xerial.snappy.use.systemlib system property to true:
6060

6161
java -Djava.library.path=(path to the installed snappyjava lib) -Dorg.xerial.snappy.use.systemlib=true ...
6262

6363
With this setting snappy-java does not use bundled native libraries. Insted it tries to load native library installed at the path specified in java.library.path.
6464

65+
66+
= Configure snappy-java using property file =
67+
68+
Prepare org-xerial-snappy.properties file (under the root path of your library) in Java's property file format.
69+
Here is a list of the available properties:
70+
71+
* org.xerial.snappy.lib.path (directory containing a snappyjava's native library)
72+
* org.xerial.snappy.lib.name (library file name)
73+
* org.xerial.snappy.tempdir (temporary directory to extract a native library bundled in snappy-java)
74+
* org.xerial.snappy.use.systemlib (if this value is true, use system installed libsnappyjava.so looking the path specified by java.library.path)
75+
76+
77+
78+

NOTICE

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ This product includes software developed by Google
22
Snappy: http://code.google.com/p/snappy/ (New BSD License)
33

44

5-
6-
5+
This library containd statically linked libstdc++. This inclusion is allowed by
6+
"GCC RUntime Library Exception"
7+
http://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html
8+
9+
== Contributors ==
10+
* Tatu Saloranta
11+
* Providing benchmark suite
12+
* Alec Wysoker
13+
* Performance and memory usage improvement
714

README

+20-36
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
This document is a copy of http://code.google.com/p/snappy-java/
22

33
---------------------------------------
4-
5-
The snappy-java is a Java port of the snappy http://code.google.com/p/snappy/, a fast compresser/decompresser (written in C++ developed by Google).
4+
The snappy-java is a Java port of the snappy http://code.google.com/p/snappy/, a fast compresser/decompresser written in C++ developed by Google.
65

76
== Features ==
8-
* [http://www.apache.org/licenses/LICENSE-2.0 Apache Licence Version 2.0]. Free for both commercial and non-commercial use!
7+
* [http://www.apache.org/licenses/LICENSE-2.0 Apache Licence Version 2.0]. Free for both commercial and non-commercial use.
98
* Fast compression/decompression tailored to 64-bit CPU architecture.
10-
* JNI-based implemenation to achieve comparable performance to the native C++ version.
11-
* Portable across various operating systems; Snappy-java contains the native libraries built for Window/Mac/Linux (32/64-bit). At runtime, snappy-java loads one of these libraries according to your machine environment (It looks system properties, `os.name` and `os.arch`).
9+
* JNI-based implementation to achieve comparable performance to the native C++ version.
10+
* Although snappy-java uses JNI, it can be used safely with multiple class loaders (e.g. Tomcat, etc.).
11+
* Portable across various operating systems; Snappy-java contains native libraries built for Window/Mac/Linux (32/64-bit). At runtime, snappy-java loads one of these libraries according to your machine environment (It looks system properties, `os.name` and `os.arch`).
1212
* Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in org.xerial.snappy.Snappy.
1313

1414
== Performance ==
15-
* Here are some [https://github.com/ning/jvm-compressor-benchmark/wiki benchmark results], comparing snappy-java and the other compressors `LZF`/`QuickLZ`/`Gzip`/`Bzip2`. Thanks [http://twitter.com/#!/cowtowncoder Tatu Saloranta @cowtowncoder] for providing the benchmark suite.
16-
* Snappy's main target is very high-speed compression/decompression with reasonable compression size. Although the compression ratio of snappy-java is modest and about the same as `LZF` (ranging 20%-100% according to the dataset), among the Java-based compressors in the benchmark snappy-java is as fast as the fastest for compression, and the decompression speed is 2x as fast to the others.
15+
* Snappy's main target is very high-speed compression/decompression with reasonable compression size. So the compression ratio of snappy-java is modest and about the same as `LZF` (ranging 20%-100% according to the dataset).
16+
17+
* Here are some [https://github.com/ning/jvm-compressor-benchmark/wiki benchmark results], comparing snappy-java and the other compressors `LZO-java`/`LZF`/`QuickLZ`/`Gzip`/`Bzip2`. Thanks [http://twitter.com/#!/cowtowncoder Tatu Saloranta @cowtowncoder] for providing the benchmark suite.
18+
* The benchmark result indicates snappy-java is the fastest compreesor/decompressor in Java:
19+
* http://ning.github.com/jvm-compressor-benchmark/results/canterbury-roundtrip-2011-07-28/index.html
20+
* The decompression speed is twice as fast as the others:
21+
* http://ning.github.com/jvm-compressor-benchmark/results/canterbury-uncompress-2011-07-28/index.html
22+
23+
1724

1825
== Download ==
19-
The current version 1.0.3 is available from here:
26+
The current stable version 1.0.3.1 is available from here:
2027
* Release version: http://maven.xerial.org/repository/artifact/org/xerial/snappy/snappy-java
2128
* [Milestone] release plans
2229
* Snapshot version (the latest beta version): http://maven.xerial.org/repository/snapshot/org/xerial/snappy/snappy-java/
@@ -40,7 +47,7 @@ String result = new String(uncompressed, "UTF-8");
4047
System.out.println(result);
4148
}}}
4249

43-
In addition, high-level methods (Snappy.compress(String), Snappy.compress(float[] ..) etc. ) and low-level ones (e.g. Snappy.rawCompress(.. ), Snappy.rawUncompress(..), etc.), which minimize memory copies, can be used. See also
50+
In addition, high-level methods (`Snappy.compress(String)`, `Snappy.compress(float[] ..)` etc. ) and low-level ones (e.g. `Snappy.rawCompress(.. )`, `Snappy.rawUncompress(..)`, etc.), which minimize memory copies, can be used. See also
4451
[http://code.google.com/p/snappy-java/source/browse/src/main/java/org/xerial/snappy/Snappy.java Snappy.java]
4552

4653
===Stream-based API===
@@ -75,44 +82,21 @@ Public discussion forum is here: [http://groups.google.com/group/xerial?hl=en Xe
7582

7683

7784
== Building from the source code ==
78-
See the [http://code.google.com/p/snappy-java/source/browse/INSTALL installation instruction]. Building from the source code is an option when JNI-related error (e.g., Java VM crash) is observed in your machine environment. To build snappy-java, you need Mercurial(hg), JDK (1.6 or higher), Maven (3.x or higher is required), g++ compiler (mingw in Windows) etc.
85+
See the [http://code.google.com/p/snappy-java/source/browse/INSTALL installation instruction]. Building from the source code is an option when your OS platform and CPU architecture is not supported. To build snappy-java, you need Mercurial(hg), JDK (1.6 or higher), Maven (3.x or higher is required), g++ compiler (mingw in Windows) etc.
7986

8087
{{{
8188
$ hg clone https://snappy-java.googlecode.com/hg/ snappy-java
8289
$ cd snappy-java
8390
$ make
8491
}}}
8592

86-
A file `target/snappy-java-$(version).jar` is the product containing the native library built for your platform.
93+
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
8794

8895
==Miscellaneous Notes==
89-
===Using snappy-java with Tomcat6 Web Server===
90-
91-
Do not include snappy-java-(version).jar in WEB-INF/lib folder of your web application package, since multiple web applications hosted by the same Tomcat server cannot load the snappy-java's native library multiple times due to the specification of JNI (See Section 11.2.4 A Type Safety Restriction http://java.sun.com/docs/books/jni/html/design.html#8628). If Snappy is loaded by different class loaders under the same JVM, you will see `UnsatisfiedLinkError` exception.
96+
===Using snappy-java with Tomcat 6 (or higher) Web Server===
9297

93-
A workaround of this problem is to put snappy-java-(version).jar file into `(TOMCAT_HOME)/lib` direcotry, in which multiple web applications can share the same native library file (.dll, .jnilib, .so) extracted from this snappy-java-(version).jar file.
98+
Simply put the snappy-java's jar to WEB-INF/lib folder of your web application. Usual JNI-library specific problem no longer exists since snappy-java version 1.0.3 or higher can be loaded by multiple class loaders in the same JVM by using native code injection to the parent class loader (Issue 21).
9499

95-
If you are using Maven for your web application, set the dependency scope as 'provided', and manually put the snappy-java jar file into (TOMCAT_HOME)/lib folder.
96100

97-
{{{
98-
<dependency>
99-
<groupId>org.xerial.snappy</groupId>
100-
<artifactId>snappy-java</artifactId>
101-
<version>(version)</version>
102-
<scope>provided</scope>
103-
</dependency>
104-
}}}
105101
----
106102
Snappy-java is developed by [http://www.xerial.org/leo Taro L. Saito]. Twitter [http://twitter.com/#!/taroleo @taroleo]
107-
108-
109-
[usage]
110-
111-
* Add snappy-java-(version).jar to your classpath
112-
* Use the compress/decompress methods defined in org.xerial.snappy.Snappy class.
113-
114-
== Contributors ==
115-
* Tatu Saloranta
116-
* Providing benchmark suite
117-
* Alec Wysoker
118-
* Performance and memory usage improvement

0 commit comments

Comments
 (0)