Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more explicit notice regarding Snappy compression #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,11 @@ factory.destroy(new File("example"), options);

* [ActiveMQ Apollo](http://activemq.apache.org/apollo/): Defaults to using leveldbjni, but falls
back to this port if the jni port is not available on your platform.

## Notes
### Snappy compression

In order to use this library with leveldb databases using Snappy compression,
you need to also include one of the following libraries:
* `org.xerial.snappy:snappy-java:1.1.8.4`
* `org.iq80.snappy:snappy:0.4`
4 changes: 4 additions & 0 deletions leveldb/src/main/java/org/iq80/leveldb/util/Snappy.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ public static boolean available()
public static void uncompress(ByteBuffer compressed, ByteBuffer uncompressed)
throws IOException
{
if (SNAPPY == null) {
throw new RuntimeException("This is a compressed database, and snappy library is not found in your classpath!" +
"See more: https://github.com/dain/leveldb/#snappy-compression");
}
SNAPPY.uncompress(compressed, uncompressed);
}

Expand Down