Skip to content

Commit c66e860

Browse files
authored
Update README.md
1 parent fe1b63f commit c66e860

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,31 @@ compressed_data = Zstd.compress(data, complession_level) # default compression_l
4848
data = Zstd.decompress(compressed_data)
4949
```
5050

51+
## JRuby
52+
This gem does not support JRuby.
53+
54+
Please consider using https://github.com/luben/zstd-jni.
55+
56+
Sample code is below.
57+
58+
```
59+
require 'java'
60+
require_relative './zstd-jni-1.5.2-3.jar'
61+
62+
str = "testtest"
63+
compressed = com.github.luben.zstd.Zstd.compress(str.to_java_bytes)
64+
puts com.github.luben.zstd.Zstd.decompress(compressed, str.length)
65+
```
66+
67+
```
68+
% ls
69+
test.rb zstd-jni-1.5.2-3.jar
70+
% ruby -v
71+
jruby 9.3.2.0 (2.6.8) 2021-12-01 0b8223f905 OpenJDK 64-Bit Server VM 11.0.12+0 on 11.0.12+0 +jit [darwin-x86_64]
72+
% ruby test.rb
73+
testtest
74+
```
75+
5176
## Development
5277

5378
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

0 commit comments

Comments
 (0)