在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:xerial/snappy-java开源软件地址:https://github.com/xerial/snappy-java开源编程语言:Java 53.0%开源软件介绍:snappy-javasnappy-java is a Java port of the snappy, a fast C++ compresser/decompresser developed by Google. Features
Performance
DownloadThe current stable version is available from here:
Using with MavenSnappy-java is available from Maven's central repository. Add the following dependency to your pom.xml:
Using with sbt
UsageFirst, import import org.xerial.snappy.Snappy; Then use String input = "Hello snappy-java! Snappy-java is a JNI-based wrapper of "
+ "Snappy, a fast compresser/decompresser.";
byte[] compressed = Snappy.compress(input.getBytes("UTF-8"));
byte[] uncompressed = Snappy.uncompress(compressed);
String result = new String(uncompressed, "UTF-8");
System.out.println(result); In addition, high-level methods ( Stream-based APIStream-based compressor/decompressor
Compatibility NotesThe original Snappy format definition did not define a file format. It later added
a "framing" format to define a file format, but by this point major software was
already using an industry standard instead -- represented in this library by the
For interoperability with other libraries, check that compatible formats are used. Note that not all libraries support all variants.
Data format compatibility matrix:
BitShuffle API (Since 1.1.3-M2)BitShuffle is an algorithm that reorders data bits (shuffle) for efficient compression (e.g., a sequence of integers, float values, etc.). To use BitShuffle routines, import import org.xerial.snappy.BitShuffle;
int[] data = new int[] {1, 3, 34, 43, 34};
byte[] shuffledByteArray = BitShuffle.shuffle(data);
byte[] compressed = Snappy.compress(shuffledByteArray);
byte[] uncompressed = Snappy.uncompress(compressed);
int[] result = BitShuffle.unshuffleIntArray(uncompress);
System.out.println(result); Shuffling and unshuffling of primitive arrays (e.g., Setting classpathIf you have snappy-java-(VERSION).jar in the current directory, use
Public discussion groupPost bug reports or feature request to the Issue Tracker: https://github.com/xerial/snappy-java/issues Public discussion forum is here: Xerial Public Discussion Group For developerssnappy-java uses sbt (simple build tool for Scala) as a build tool. Here is a simple usage
If you need to see detailed debug messages, launch sbt with
For the details of sbt usage, see my blog post: Building Java Projects with sbt Building from the source codeSee the build 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 Git, JDK (1.6 or higher), g++ compiler (mingw in Windows) etc.
When building on Solaris, use
A file Miscellaneous NotesUsing pure-java Snappy implementationsnappy-java can optionally use a pure-java implementation of Snappy based on aircompressor. This implementation is selected when no native Snappy library for your platform is found. You can also force using this pure-java implementation by setting a JVM property Using snappy-java with Tomcat 6 (or higher) Web ServerSimply 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. Configure snappy-java using property filePrepare org-xerial-snappy.properties file (under the root path of your library) in Java's property file format. Here is a list of the available properties:
Snappy-java is developed by Taro L. Saito. Twitter @taroleo |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论