Skip to content

Commit 697dedf

Browse files
committed
Add more explicit notice regarding Snappy compression
Fixes #119 Signed-off-by: Stavros Ntentos <[email protected]>
1 parent 130db69 commit 697dedf

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,11 @@ factory.destroy(new File("example"), options);
172172

173173
* [ActiveMQ Apollo](http://activemq.apache.org/apollo/): Defaults to using leveldbjni, but falls
174174
back to this port if the jni port is not available on your platform.
175+
176+
## Notes
177+
### Snappy compression
178+
179+
In order to use this library with leveldb databases using Snappy compression,
180+
you need to also include one of the following libraries:
181+
* `org.xerial.snappy:snappy-java:1.1.8.4`
182+
* `org.iq80.snappy:snappy:0.4`

leveldb/src/main/java/org/iq80/leveldb/util/Snappy.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ public static boolean available()
231231
public static void uncompress(ByteBuffer compressed, ByteBuffer uncompressed)
232232
throws IOException
233233
{
234+
if (SNAPPY == null)
235+
throw new RuntimeException("This is a compressed database, and snappy library is not found in your classpath!" +
236+
" (e.g. https://github.com/dain/leveldb/#snappy-compression)");
234237
SNAPPY.uncompress(compressed, uncompressed);
235238
}
236239

0 commit comments

Comments
 (0)