Skip to content

Commit

Permalink
Add more explicit notice regarding Snappy compression
Browse files Browse the repository at this point in the history
Fixes dain#119

Signed-off-by: Stavros Ntentos <[email protected]>
  • Loading branch information
stdedos committed Feb 17, 2021
1 parent 130db69 commit 50c1882
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit 50c1882

Please sign in to comment.