SpringMT / zstd-ruby

Ruby binding for zstd(Zstandard - Fast real-time compression algorithm)
https://github.com/facebook/zstd
BSD 3-Clause "New" or "Revised" License
69 stars 16 forks source link

Jruby support? #12

Closed brauliobo closed 2 years ago

brauliobo commented 6 years ago

In the readme there is no indication wheter jruby is supported

SpringMT commented 6 years ago

Sorry. Currently, jruby is not supported. PR is welcome!

pikitgb commented 5 years ago

@brauliobo You can use it with JRuby from this Java source https://github.com/airlift/aircompressor/tree/master/src/main/java/io/airlift/compress/zstd

SpringMT commented 2 years ago

In JRuby, try to use https://github.com/luben/zstd-jni ? (jar file can download here https://repo1.maven.org/maven2/com/github/luben/zstd-jni)

Sample code is below

require 'java'
require_relative './zstd-jni-1.5.2-3.jar'

str = "testtest"
compressed = com.github.luben.zstd.Zstd.compress(str.to_java_bytes)
puts com.github.luben.zstd.Zstd.decompress(compressed, str.length)
% ls
test.rb              zstd-jni-1.5.2-3.jar
% ruby -v
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]
% ruby test.rb
testtest
SpringMT commented 2 years ago

Update README https://github.com/SpringMT/zstd-ruby#jruby