You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: INSTALL
+15-1
Original file line number
Diff line number
Diff line change
@@ -54,11 +54,25 @@ $ make native
54
54
$ make clean-native native
55
55
56
56
57
-
= Using system installed libsnappyjava (or snappyjava.dll)
57
+
= Using system installed libsnappyjava (or snappyjava.dll) =
58
58
59
59
Set org.xerial.snappy.use.systemlib system property to true:
60
60
61
61
java -Djava.library.path=(path to the installed snappyjava lib) -Dorg.xerial.snappy.use.systemlib=true ...
62
62
63
63
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.
64
64
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)
Copy file name to clipboardExpand all lines: README
+20-36
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,29 @@
1
1
This document is a copy of http://code.google.com/p/snappy-java/
2
2
3
3
---------------------------------------
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.
6
5
7
6
== 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.
9
8
* 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`).
12
12
* Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in org.xerial.snappy.Snappy.
13
13
14
14
== 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:
* 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");
40
47
System.out.println(result);
41
48
}}}
42
49
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
@@ -75,44 +82,21 @@ Public discussion forum is here: [http://groups.google.com/group/xerial?hl=en Xe
75
82
76
83
77
84
== 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.
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.
87
94
88
95
==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===
92
97
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-javaversion 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).
94
99
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.
96
100
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
-
}}}
105
101
----
106
102
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.
0 commit comments