Merge branch 'release/1.0.5-M1'

This commit is contained in:
Taro L. Saito 2012-09-27 11:10:57 +09:00
commit 7b2546911b
12 changed files with 503 additions and 406 deletions

20
.gitignore vendored Normal file
View File

@ -0,0 +1,20 @@
*~
*.class
*.log
# IntelliJ
.idea
.idea_modules
# sbt specific
bin/.lib
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies

View File

@ -82,7 +82,11 @@ test: $(NATIVE_DLL)
$(MVN) test
win32:
$(MAKE) native CXX=mingw32-g++ OS_NAME=Windows OS_ARCH=x86
$(MAKE) native CROSS_PREFIX=i686-w64-mingw32- OS_NAME=Windows OS_ARCH=x86
# for cross-compilation on Ubuntu, install the g++-mingw-w64-x86-64 package
win64:
$(MAKE) native CROSS_PREFIX=x86_64-w64-mingw32- OS_NAME=Windows OS_ARCH=amd64
mac32:
$(MAKE) native OS_NAME=Mac OS_ARCH=i386
@ -90,6 +94,14 @@ mac32:
linux32:
$(MAKE) native OS_NAME=Linux OS_ARCH=i386
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabi package
linux-arm:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabihf package
linux-armhf:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armhf
clean-native-linux32:
$(MAKE) clean-native OS_NAME=Linux OS_ARCH=i386

View File

@ -105,15 +105,15 @@ Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
Mac-x86_64_LIBNAME := libsnappyjava.jnilib
Mac-x86_64_SNAPPY_FLAGS :=
Windows-x86_CXX := mingw32-g++
Windows-x86_STRIP := strip
Windows-x86_CXX := $(CROSS_PREFIX)g++
Windows-x86_STRIP := $(CROSS_PREFIX)strip
Windows-x86_CXXFLAGS := -Ilib/inc_win -O2
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-x86_LIBNAME := snappyjava.dll
Windows-x86_SNAPPY_FLAGS :=
Windows-amd64_CXX := x86_64-w64-mingw32-g++
Windows-amd64_STRIP := x86_64-w64-mingw32-strip
Windows-amd64_CXX := $(CROSS_PREFIX)g++
Windows-amd64_STRIP := $(CROSS_PREFIX)strip
Windows-amd64_CXXFLAGS := -Ilib/inc_win -O2
Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-amd64_LIBNAME := snappyjava.dll

59
Milestone.md Normal file
View File

@ -0,0 +1,59 @@
## Features under consideration
* `SnappyIndexer` for parallel compression/decompression
* CUI commands (snap/unsnap)
## snappy-java-1.0.4.1 (5 September 2011)
* Fixes issue 33: Fixes a problem when reading incomplete input stream
## snappy-java-1.0.4 (September 22nd, 2011)
* Upgrade to snappy-1.0.4
* Enhanced the Javadoc
## snappy-java-1.0.3.3 (September 10th, 2011)
* Add support for Oracle JRockit JVM. (issue 28)
## snappy-java-1.0.3.2 (August 23rd, 2011)
* Upgrade from the previous release is optional
* Add system properites to switch sytem installed native library or bundled
library (issue 20, issue 26)
* source code tar ball (issue 25)
* primitive array read/write support (issue 24)
## snappy-java-1.0.3.1 (August 2nd, 2011)
* Maintenance release (no significant change)
* Refactoring code
* Rebuild win32 binary
## snappy-java-1.0.3 (July 11st, 2011)
* Deprected SnappyException. Instead snappy-java uses IOException to issue
errors. This change is necessary to support JNI code injection to a parent
class loader.
## snappy-java-1.0.3-rc4 (June 27th, 2011)
* JNI interface injection so that multiple applications can share the native
code. Issue 21
## snappy-java-1.0.3-rc3 (June 21st, 2011)
* Fixes issue 18, issue 19
* Reduces memory footprint (contribution from Arec Wysoker)
## snappy-java-1.0.3-rc2 (June 7th, 2011)
* Fixes issue 17
## snappy-java-1.0.3-rc1 (June 4th, 2011)
* Upgrade to snappy-1.0.3 done.
* libstdc++ embedding (only for Linux version) done.
* Minor bug fixes
## snappy-java-1.0.1-rc4 (April 11th, 2011)
* Primitive array support (e.g. `int[]`, `float[]`, etc.) issue 10
* String compression/decompression
## snappy-java-1.0.1-rc3 (April 4th, 2011)
* Running tests under win32/mac32, etc.
## snappy-java-1.0.1-rc2 (April 2nd, 2011)
* Adding `SnappyOutputStream` `SnappyInputStream` issue 3
* March 29th. Started snappy-java project

102
README
View File

@ -1,102 +0,0 @@
This document is a copy of http://code.google.com/p/snappy-java/
---------------------------------------
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.
== Features ==
* [http://www.apache.org/licenses/LICENSE-2.0 Apache Licence Version 2.0]. Free for both commercial and non-commercial use.
* Fast compression/decompression tailored to 64-bit CPU architecture.
* JNI-based implementation to achieve comparable performance to the native C++ version.
* Although snappy-java uses JNI, it can be used safely with multiple class loaders (e.g. Tomcat, etc.).
* 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`).
* Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in org.xerial.snappy.Snappy.
== Performance ==
* 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).
* 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.
* The benchmark result indicates snappy-java is the fastest compreesor/decompressor in Java:
* http://ning.github.com/jvm-compressor-benchmark/results/canterbury-roundtrip-2011-07-28/index.html
* The decompression speed is twice as fast as the others:
* http://ning.github.com/jvm-compressor-benchmark/results/canterbury-uncompress-2011-07-28/index.html
== Download ==
The current stable version 1.0.3.1 is available from here:
* Release version: http://maven.xerial.org/repository/artifact/org/xerial/snappy/snappy-java
* [Milestone] release plans
* Snapshot version (the latest beta version): http://maven.xerial.org/repository/snapshot/org/xerial/snappy/snappy-java/
If you are a Maven user, see [#Using_with_Maven]
== Usage ==
First, import `org.xerial.snapy.Snappy` in your Java code:
{{{
import org.xerial.snappy.Snappy;
}}}
Then use `Snappy.compress(byte[])` and `Snappy.uncompress(byte[])`:
{{{
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 (`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
[http://code.google.com/p/snappy-java/source/browse/src/main/java/org/xerial/snappy/Snappy.java Snappy.java]
===Stream-based API===
Stream-based compressor/decompressor `SnappyOutputStream`/`SnappyInputStream` are also available for reading/writing large data sets.
===Setting classpath==
If you have snappy-java-(VERSION).jar in the current directory, use `-classpath` option as follows:
{{{
$ javac -classpath ".;snappy-java-(VERSION).jar" Sample.java # in Windows
or
$ javac -classpath ".:snappy-java-(VERSION).jar" Sample.java # in Mac or Linux
}}}
===Using with Maven===
* Snappy-java is available from Maven's central repository: http://repo1.maven.org/maven2/org/xerial/snappy/snappy-java
Add the following dependency to your pom.xml:
{{{
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>(version)</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
}}}
==Public discussion group==
Post bug reports or feature request to the Issue Tracker: http://code.google.com/p/snappy-java/issues/list
Public discussion forum is here: [http://groups.google.com/group/xerial?hl=en Xerial Public Discussion Group].
== Building from the source code ==
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.
{{{
$ hg clone https://snappy-java.googlecode.com/hg/ snappy-java
$ cd snappy-java
$ make
}}}
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
==Miscellaneous Notes==
===Using snappy-java with Tomcat 6 (or higher) Web Server===
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).
----
Snappy-java is developed by [http://www.xerial.org/leo Taro L. Saito]. Twitter [http://twitter.com/#!/taroleo @taroleo]

119
README.md Executable file
View File

@ -0,0 +1,119 @@
The snappy-java is a Java port of the snappy
<http://code.google.com/p/snappy/>, a fast C++ compresser/decompresser developed by Google.
## Features
* [Apache License Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Free for both commercial and non-commercial use.
* Fast compression/decompression tailored to 64-bit CPU architecture.
* JNI-based implementation to achieve comparable performance to the native C++ version.
* Although snappy-java uses JNI, it can be used safely with multiple class loaders (e.g. Tomcat, etc.).
* 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`).
* Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in org.xerial.snappy.Snappy.
## Performance
* 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).
* Here are some [benchmark results](https://github.com/ning/jvm-compressor-benchmark/wiki), comparing
snappy-java and the other compressors
`LZO-java`/`LZF`/`QuickLZ`/`Gzip`/`Bzip2`. Thanks [Tatu Saloranta @cotowncoder](http://twitter.com/#!/cowtowncoder) for providing the benchmark suite.
* The benchmark result indicates snappy-java is the fastest compreesor/decompressor in Java:
* <http://ning.github.com/jvm-compressor-benchmark/results/canterbury-roundtrip-2011-07-28/index.html>
* The decompression speed is twice as fast as the others:
* <http://ning.github.com/jvm-compressor-benchmark/results/canterbury-uncompress-2011-07-28/index.html>
## Download
The current stable version is available from here:
* Release version: http://maven.xerial.org/repository/artifact/org/xerial/snappy/snappy-java
* [release plans](./snappy-java/Milestone.md)
* Snapshot version (the latest beta version): https://oss.sonatype.org/content/repositories/snapshots/org/xerial/snappy/snappy-java/
If you are a Maven user, see [#Using_with_Maven]
## Usage
First, import `org.xerial.snapy.Snappy` in your Java code:
import org.xerial.snappy.Snappy;
Then use `Snappy.compress(byte[])` and `Snappy.uncompress(byte[])`:
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 (`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
[Snappy.java](https://github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/Snappy.java)
### Stream-based API
Stream-based compressor/decompressor `SnappyOutputStream`/`SnappyInputStream` are also available for reading/writing large data sets.
### Setting classpath
If you have snappy-java-(VERSION).jar in the current directory, use `-classpath` option as follows:
$ javac -classpath ".;snappy-java-(VERSION).jar" Sample.java # in Windows
or
$ javac -classpath ".:snappy-java-(VERSION).jar" Sample.java # in Mac or Linux
### Using with Maven
* Snappy-java is available from Maven's central repository: <http://repo1.maven.org/maven2/org/xerial/snappy/snappy-java>
Add the following dependency to your pom.xml:
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>(version)</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
## Public discussion group
Post bug reports or feature request to the Issue Tracker: <https://github.com/xerial/snappy-java/issues>
Public discussion forum is here: <http://groups.google.com/group/xerial?hl=en Xerial Public Discussion Group>
## Building from the source code
See the [installation instruction](https://github.com/xerial/snappy-java/blob/develop/INSTALL). 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), Maven (3.x or higher is required), g++ compiler (mingw in Windows) etc.
$ git clone https://github.com/xerial/snappy-java.git
$ cd snappy-java
$ make
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
## Cross-compiling for other platforms
The Makefile contains rules for cross-compiling the native library for other platforms so that the snappy-java JAR can support multiple platforms. For example, to build the native libraries for x86 Linux, x86 and x86-64 Windows, and soft- and hard-float ARM:
$ make linux32 win32 win64 linux-arm linux-armhf
If you append `snappy` to the line above, it will also build the native library for the current platform and then build the snappy-java JAR (containing all native libraries built so far).
Of course, you must first have the necessary cross-compilers and development libraries installed for each target CPU and OS. For example, on Ubuntu 12.04 for x86-64, install the following packages for each target:
* linux32: `sudo apt-get install g++-multilib libc6-dev-i386 lib32stdc++6`
* win32: `sudo apt-get install g++-mingw-w64-i686`
* win64: `sudo apt-get install g++-mingw-w64-x86-64`
* arm: `sudo apt-get install g++-arm-linux-gnueabi`
* armhf: `sudo apt-get install g++-arm-linux-gnueabihf`
Unfortunately, cross-compiling for Mac OS X is not currently possible; you must compile within OS X.
If you are using Mac and openjdk7 (or higher), use the following option:
$ make native LIBNAME=libsnappyjava.dylib
## Miscellaneous Notes
### Using snappy-java with Tomcat 6 (or higher) Web Server
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).
----
Snappy-java is developed by [Taro L. Saito](http://www.xerial.org/leo). Twitter [@taroleo](http://twitter.com/#!/taroleo)

581
pom.xml
View File

@ -1,298 +1,283 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.0.5-SNAPSHOT</version>
<name>Snappy for Java</name>
<description>snappy-java: A fast compression/decompression library</description>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>leo</id>
<name>Taro L. Saito</name>
<email>leo@xerial.org</email>
<organization>Xerial Project</organization>
<roles>
<role>Architect</role>
<role>Project Manager</role>
<role>Chief Developer</role>
</roles>
<timezone>+9</timezone>
</developer>
</developers>
<organization>
<name>xerial.org</name>
<url>http://www.xerial.org/</url>
</organization>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>org/xerial/snappy/VERSION</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>org/xerial/snappy/*.bytecode</include>
<include>org/xerial/snappy/native/**</include>
</includes>
</resource>
<resource>
<directory>${basedir}</directory>
<targetPath>META-INF/maven/${project.groupId}/${project.artifactId}</targetPath>
<includes>
<include>LICENSE*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- do not run site-deploy goal, included in the default settings -->
<goals>deploy</goals>
<connectionUrl>scm:hg:https://snappy-java.googlecode.com/hg/</connectionUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<charset>UTF-8</charset>
<locale>en_US</locale>
<show>public</show>
<stylesheetfile>stylesheet.css</stylesheetfile>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${pproject.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator>
<Export-Package>org.xerial.snappy</Export-Package>
<Import-Package>org.osgi.framework;version="[1.5,2)"</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptors>
<descriptor>src/assembly/project.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
</build>
<url>http://code.google.com/p/snappy-java/</url>
<issueManagement>
<system>Google Code</system>
<url>http://code.google.com/p/snappy-java/issues/list</url>
</issueManagement>
<inceptionYear>2011</inceptionYear>
<scm>
<connection>scm:hg:https://snappy-java.googlecode.com/hg/</connection>
<developerConnection>scm:hg:default</developerConnection>
<url>scm:hg:https://snappy-java.googlecode.com/hg/</url>
</scm>
<distributionManagement>
<!-- for development releases -->
<site>
<id>xerial.scp</id>
<url>scpexe://www.xerial.org/home/web/maven.xerial.org/repository/site</url>
</site>
<repository>
<id>xerial.scp</id>
<name>Xerial Maven Repository</name>
<url>scpexe://www.xerial.org/home/web/maven.xerial.org/repository/artifact</url>
</repository>
<snapshotRepository>
<id>xerial.scp</id>
<name>Xerial Maven Snapshot Repository</name>
<url>scpexe://www.xerial.org/home/web/maven.xerial.org/repository/snapshot</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
<profiles>
<!-- for directly sending artifacts to sourceforge.net repository -->
<profile>
<id>sourceforge</id>
<distributionManagement>
<repository>
<id>xerial.sourceforge</id>
<name>Xerial maven repository at sourceforge.jp</name>
<url>scpexe://shell.sourceforge.jp/home/groups/x/xe/xerial/htdocs/maven/release</url>
</repository>
</distributionManagement>
</profile>
<!-- for local updates -->
<profile>
<id>xerial.local</id>
<distributionManagement>
<repository>
<id>xerial.local</id>
<name>Xerial Maven Repository</name>
<url>file:///home/web/maven.xerial.org/repository/artifact</url>
</repository>
<snapshotRepository>
<id>xerial.local</id>
<name>Xerial Maven Snapshot Repository</name>
<url>file:///home/web/maven.xerial.org/repository/snapshot</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
<site>
<id>xerial.local</id>
<url>file:///home/web/maven.xerial.org/repository/site</url>
</site>
</distributionManagement>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.4</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>core</artifactId>
<version>4.3.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>xerial-core</artifactId>
<version>1.0.21</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.0.5-M1</version>
<name>Snappy for Java</name>
<description>snappy-java: A fast compression/decompression library</description>
<packaging>bundle</packaging>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>leo</id>
<name>Taro L. Saito</name>
<email>leo@xerial.org</email>
<organization>Xerial Project</organization>
<roles>
<role>Architect</role>
<role>Project Manager</role>
<role>Chief Developer</role>
</roles>
<timezone>+9</timezone>
</developer>
</developers>
<organization>
<name>xerial.org</name>
<url>http://www.xerial.org/</url>
</organization>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>org/xerial/snappy/VERSION</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>org/xerial/snappy/*.bytecode</include>
<include>org/xerial/snappy/native/**</include>
</includes>
</resource>
<resource>
<directory>${basedir}</directory>
<targetPath>META-INF/maven/${project.groupId}/${project.artifactId}</targetPath>
<includes>
<include>LICENSE*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- do not run site-deploy goal, included in the default settings -->
<goals>deploy</goals>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<configuration>
<useAgent>true</useAgent>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<charset>UTF-8</charset>
<locale>en_US</locale>
<show>public</show>
<stylesheetfile>stylesheet.css</stylesheetfile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${pproject.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator>
<Export-Package>org.xerial.snappy</Export-Package>
<Import-Package>org.osgi.framework;version="[1.5,2)"</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptors>
<descriptor>src/assembly/project.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
</build>
<url>http://github.com/xerial/snappy-java/</url>
<issueManagement>
<system>GitHub</system>
<url>http://github.com/xerial/snappy-java/issues/list</url>
</issueManagement>
<inceptionYear>2011</inceptionYear>
<scm>
<connection>scm:git@github.com:xerial/snappy-java.git</connection>
<developerConnection>scm:git:git@github.com:xerial/snappy-java.git</developerConnection>
<url>git@github.com:xerial/snappy-java.git</url>
</scm>
<profiles>
<!-- for local updates -->
<profile>
<id>xerial.local</id>
<distributionManagement>
<repository>
<id>xerial.local</id>
<name>Xerial Maven Repository</name>
<url>file:///home/web/maven.xerial.org/repository/artifact</url>
</repository>
<snapshotRepository>
<id>xerial.local</id>
<name>Xerial Maven Snapshot Repository</name>
<url>file:///home/web/maven.xerial.org/repository/snapshot</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
<site>
<id>xerial.local</id>
<url>file:///home/web/maven.xerial.org/repository/site</url>
</site>
</distributionManagement>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.4</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>core</artifactId>
<version>4.3.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>xerial-core</artifactId>
<version>1.0.21</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -26,6 +26,7 @@ package org.xerial.snappy;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.ExceptionInInitializerError;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@ -33,6 +34,9 @@ import java.util.Properties;
/**
* Snappy API for data compression/decompression
*
* Note: if the native libraries cannot be loaded, then an ExceptionInInitializerError
* will be thrown at first use of this class.
*
* @author leo
*
@ -44,7 +48,7 @@ public class Snappy
impl = SnappyLoader.load();
}
catch (Exception e) {
e.printStackTrace();
throw new ExceptionInInitializerError(e);
}
}