lz4-ruby 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +2 -2
- data/README.rdoc +5 -0
- data/Rakefile +15 -8
- data/VERSION +1 -1
- data/lib/lz4-jruby.rb +3 -0
- data/lib/lz4-ruby.rb +2 -0
- data/pom.xml +71 -0
- data/{test → spec}/helper.rb +7 -2
- data/spec/lz4_compressHC_spec.rb +50 -0
- data/spec/lz4_compress_spec.rb +50 -0
- data/src/main/java/com/headius/jruby/lz4/LZ4Internal.java +64 -0
- data/src/main/java/com/headius/jruby/lz4/LZ4Library.java +18 -0
- metadata +93 -106
- data/test/test_lz4-ruby.rb +0 -109
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzllZTQyNmZkZjdiNzQ4OTY4ZmU0ZDA4YTlkNzY1MjlmOTE1NjBhYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTczZDc4OGM2NjhkNWY5MTRiZjZjOTBkOWQ0ZTIwOWNlNWZkZjkwNw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZWJmN2Y3NmNmMmI4ODAzY2YzYzEyZWQ1NTFlNDc4YTkzNWU1NGY5ZmFjMmIy
|
10
|
+
YThkM2M2NThmNjZiZGYyMTFhOGVhY2FkNzUzNjE1MjRmNjI1ODFiZjE2MDk2
|
11
|
+
ZmE1NTllNGFkMmMyMzdhOTIyNDNkYTAyNDkyMTZlOWU5YzZkNDI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Y2IyNWFiMjBiMDdjNGE3NWY4YTcyMGI4ZmU1YWM0MTM4MmUxZTY5MThkZTVj
|
14
|
+
OTg4MjcyZGIyZTA0MmY3YWJjMjI3Mjc4MjE3YTA0Y2M3ZDZlZmZiOTg1M2Fj
|
15
|
+
Mzg3MDk1NWI0YjY2MmY4NDhjOTE1NTgwOTdmMmY1YWYwZDAyNDE=
|
data/Gemfile
CHANGED
@@ -6,9 +6,9 @@ source "http://rubygems.org"
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
|
-
gem "
|
9
|
+
gem "rspec"
|
10
10
|
gem "rdoc", "~> 3.12"
|
11
|
-
gem "bundler"
|
11
|
+
gem "bundler"
|
12
12
|
gem "jeweler", "~> 1.8.3"
|
13
13
|
gem "rake-compiler", ">= 0"
|
14
14
|
end
|
data/README.rdoc
CHANGED
@@ -33,6 +33,7 @@ Tested on VirtualBox VM : 2-core / 4GB RAM (Host : Core i5-2520M / 8GB RAM).
|
|
33
33
|
|
34
34
|
== TODO
|
35
35
|
|
36
|
+
* replace calloc() with xalloc() in lz4hc.c
|
36
37
|
* Write API documents.
|
37
38
|
|
38
39
|
== Copyright
|
@@ -40,6 +41,10 @@ Tested on VirtualBox VM : 2-core / 4GB RAM (Host : Core i5-2520M / 8GB RAM).
|
|
40
41
|
Copyright (c) 2012 KOMIYA Atsushi.
|
41
42
|
See LICENSE.txt for further details.
|
42
43
|
|
44
|
+
== Contributors
|
45
|
+
|
46
|
+
* Charles Oliver Nutter <headius at headius.com>
|
47
|
+
|
43
48
|
== About LZ4
|
44
49
|
|
45
50
|
This Rubygem includes LZ4 codes written by Yann Collet.
|
data/Rakefile
CHANGED
@@ -36,14 +36,10 @@ Jeweler::RubygemsDotOrgTasks.new
|
|
36
36
|
$gemspec = jeweler_tasks.gemspec
|
37
37
|
$gemspec.version = jeweler_tasks.jeweler.version
|
38
38
|
|
39
|
-
require '
|
40
|
-
|
41
|
-
test.libs << 'lib' << 'test'
|
42
|
-
test.pattern = 'test/**/test_*.rb'
|
43
|
-
test.verbose = true
|
44
|
-
end
|
39
|
+
require 'rspec/core/rake_task'
|
40
|
+
RSpec::Core::RakeTask.new(:spec)
|
45
41
|
|
46
|
-
task :default => :
|
42
|
+
task :default => :spec
|
47
43
|
|
48
44
|
require 'rdoc/task'
|
49
45
|
Rake::RDocTask.new do |rdoc|
|
@@ -83,15 +79,26 @@ end
|
|
83
79
|
|
84
80
|
task "build:cross" => [:modify_gemspec_for_windows, :cross, :build] do
|
85
81
|
file = "pkg/lz4-ruby-#{get_version}.gem"
|
86
|
-
mv file, "#{file.ext}-x86-mingw32.gem"
|
87
82
|
end
|
88
83
|
|
84
|
+
task "build:jruby" => [:modify_gemspec_for_jruby, :compile_jruby, :build]
|
85
|
+
|
89
86
|
task :modify_gemspec_for_windows do
|
90
87
|
$gemspec.extensions = []
|
91
88
|
$gemspec.files.include("lib/?.?/*.so")
|
92
89
|
$gemspec.platform = "x86-mingw32"
|
93
90
|
end
|
94
91
|
|
92
|
+
task :modify_gemspec_for_jruby do
|
93
|
+
$gemspec.extensions = []
|
94
|
+
$gemspec.files.include("lib/*.jar")
|
95
|
+
$gemspec.platform = "java"
|
96
|
+
end
|
97
|
+
|
98
|
+
task :compile_jruby do
|
99
|
+
system 'mvn package'
|
100
|
+
end
|
101
|
+
|
95
102
|
def get_version
|
96
103
|
`cat VERSION`.chomp
|
97
104
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/lz4-jruby.rb
ADDED
data/lib/lz4-ruby.rb
CHANGED
data/pom.xml
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
2
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
3
|
+
<modelVersion>4.0.0</modelVersion>
|
4
|
+
|
5
|
+
<groupId>com.headius.jruby.lz4</groupId>
|
6
|
+
<artifactId>lz4ruby</artifactId>
|
7
|
+
<version>0.2.0</version>
|
8
|
+
<packaging>jar</packaging>
|
9
|
+
|
10
|
+
<name>lz4ruby</name>
|
11
|
+
<url>http://maven.apache.org</url>
|
12
|
+
|
13
|
+
<properties>
|
14
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
15
|
+
</properties>
|
16
|
+
|
17
|
+
<dependencies>
|
18
|
+
<dependency>
|
19
|
+
<groupId>junit</groupId>
|
20
|
+
<artifactId>junit</artifactId>
|
21
|
+
<version>3.8.1</version>
|
22
|
+
<scope>test</scope>
|
23
|
+
</dependency>
|
24
|
+
<dependency>
|
25
|
+
<groupId>net.jpountz.lz4</groupId>
|
26
|
+
<artifactId>lz4</artifactId>
|
27
|
+
<version>1.1.1</version>
|
28
|
+
</dependency>
|
29
|
+
<dependency>
|
30
|
+
<groupId>org.jruby</groupId>
|
31
|
+
<artifactId>jruby</artifactId>
|
32
|
+
<version>1.7.0</version>
|
33
|
+
<scope>provided</scope>
|
34
|
+
</dependency>
|
35
|
+
</dependencies>
|
36
|
+
|
37
|
+
<build>
|
38
|
+
<plugins>
|
39
|
+
<plugin>
|
40
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
41
|
+
<version>3.1</version>
|
42
|
+
<configuration>
|
43
|
+
<source>1.6</source>
|
44
|
+
<target>1.6</target>
|
45
|
+
</configuration>
|
46
|
+
</plugin>
|
47
|
+
<plugin>
|
48
|
+
<groupId>org.apache.maven.plugins</groupId>
|
49
|
+
<artifactId>maven-shade-plugin</artifactId>
|
50
|
+
<version>2.0</version>
|
51
|
+
<configuration>
|
52
|
+
<relocations>
|
53
|
+
<relocation>
|
54
|
+
<pattern>net.jpountz</pattern>
|
55
|
+
<shadedPattern>com.headius.jruby.lz4.vendor.net.jpountz</shadedPattern>
|
56
|
+
</relocation>
|
57
|
+
</relocations>
|
58
|
+
<outputFile>${basedir}/lib/lz4ruby.jar</outputFile>
|
59
|
+
</configuration>
|
60
|
+
<executions>
|
61
|
+
<execution>
|
62
|
+
<phase>package</phase>
|
63
|
+
<goals>
|
64
|
+
<goal>shade</goal>
|
65
|
+
</goals>
|
66
|
+
</execution>
|
67
|
+
</executions>
|
68
|
+
</plugin>
|
69
|
+
</plugins>
|
70
|
+
</build>
|
71
|
+
</project>
|
data/{test → spec}/helper.rb
RENAMED
@@ -8,7 +8,6 @@ rescue Bundler::BundlerError => e
|
|
8
8
|
exit e.status_code
|
9
9
|
end
|
10
10
|
require 'test/unit'
|
11
|
-
require 'shoulda'
|
12
11
|
|
13
12
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
13
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'ext/lz4ruby'))
|
@@ -24,5 +23,11 @@ EOS
|
|
24
23
|
|
25
24
|
require 'lz4-ruby'
|
26
25
|
|
27
|
-
|
26
|
+
def generate_random_bytes(len)
|
27
|
+
result = []
|
28
|
+
len.times do |t|
|
29
|
+
result << rand(256)
|
30
|
+
end
|
31
|
+
return result.pack("C*")
|
28
32
|
end
|
33
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
|
3
|
+
describe "LZ4::compress" do
|
4
|
+
LOOP_COUNT = 257
|
5
|
+
|
6
|
+
context "give empty text" do
|
7
|
+
compressed = LZ4.compressHC("")
|
8
|
+
uncompressed = LZ4.uncompress(compressed)
|
9
|
+
|
10
|
+
it "should be able to uncompress" do
|
11
|
+
expect(uncompressed).to eql("")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "give long text" do
|
16
|
+
text = "a" * 131073
|
17
|
+
compressed = LZ4.compressHC(text)
|
18
|
+
uncompressed = LZ4.uncompress(compressed)
|
19
|
+
|
20
|
+
it "should be able to uncompress" do
|
21
|
+
expect(uncompressed).to eql(text)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
LOOP_COUNT.times do |t|
|
26
|
+
len = t + 1
|
27
|
+
text = "a" * len
|
28
|
+
|
29
|
+
context "give text of #{len} \"a\"'s" do
|
30
|
+
compressed = LZ4.compressHC(text)
|
31
|
+
uncompressed = LZ4.uncompress(compressed)
|
32
|
+
it "should be able to uncompress" do
|
33
|
+
expect(uncompressed).to eql(text)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
LOOP_COUNT.times do |t|
|
39
|
+
len = t + 1
|
40
|
+
text = generate_random_bytes(len)
|
41
|
+
|
42
|
+
context "give text of #{len} bytes" do
|
43
|
+
compressed = LZ4.compressHC(text)
|
44
|
+
uncompressed = LZ4.uncompress(compressed)
|
45
|
+
it "should be able to uncompress" do
|
46
|
+
expect(uncompressed).to eql(text)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
|
3
|
+
describe "LZ4::compress" do
|
4
|
+
LOOP_COUNT = 257
|
5
|
+
|
6
|
+
context "give empty text" do
|
7
|
+
compressed = LZ4.compress("")
|
8
|
+
uncompressed = LZ4.uncompress(compressed)
|
9
|
+
|
10
|
+
it "should be able to uncompress" do
|
11
|
+
expect(uncompressed).to eql("")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "give long text" do
|
16
|
+
text = "a" * 131073
|
17
|
+
compressed = LZ4.compress(text)
|
18
|
+
uncompressed = LZ4.uncompress(compressed)
|
19
|
+
|
20
|
+
it "should be able to uncompress" do
|
21
|
+
expect(uncompressed).to eql(text)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
LOOP_COUNT.times do |t|
|
26
|
+
len = t + 1
|
27
|
+
text = "a" * len
|
28
|
+
|
29
|
+
context "give text of #{len} \"a\"'s" do
|
30
|
+
compressed = LZ4.compress(text)
|
31
|
+
uncompressed = LZ4.uncompress(compressed)
|
32
|
+
it "should be able to uncompress" do
|
33
|
+
expect(uncompressed).to eql(text)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
LOOP_COUNT.times do |t|
|
39
|
+
len = t + 1
|
40
|
+
text = generate_random_bytes(len)
|
41
|
+
|
42
|
+
context "give text of #{len} bytes" do
|
43
|
+
compressed = LZ4.compress(text)
|
44
|
+
uncompressed = LZ4.uncompress(compressed)
|
45
|
+
it "should be able to uncompress" do
|
46
|
+
expect(uncompressed).to eql(text)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
package com.headius.jruby.lz4;
|
2
|
+
|
3
|
+
import net.jpountz.lz4.LZ4Compressor;
|
4
|
+
import net.jpountz.lz4.LZ4Factory;
|
5
|
+
import org.jruby.RubyInteger;
|
6
|
+
import org.jruby.RubyString;
|
7
|
+
import org.jruby.anno.JRubyMethod;
|
8
|
+
import org.jruby.runtime.ThreadContext;
|
9
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
10
|
+
import org.jruby.util.ByteList;
|
11
|
+
|
12
|
+
public class LZ4Internal {
|
13
|
+
private static final LZ4Factory FACTORY = LZ4Factory.fastestInstance();
|
14
|
+
|
15
|
+
public static IRubyObject compress_internal(ThreadContext context, LZ4Compressor compressor, IRubyObject _header, IRubyObject _input, IRubyObject _in_size) {
|
16
|
+
RubyString input = _input.convertToString();
|
17
|
+
RubyString header = _header.convertToString();
|
18
|
+
RubyInteger in_size = _in_size.convertToInteger();
|
19
|
+
|
20
|
+
ByteList inputBL = input.getByteList();
|
21
|
+
int srcSize = (int)in_size.getLongValue();
|
22
|
+
|
23
|
+
ByteList headerBL = header.getByteList();
|
24
|
+
int headerSize = headerBL.getRealSize();
|
25
|
+
|
26
|
+
int bufSize = compressor.maxCompressedLength(srcSize);
|
27
|
+
byte[] buf = new byte[bufSize + headerSize];
|
28
|
+
|
29
|
+
System.arraycopy(headerBL.getUnsafeBytes(), headerBL.getBegin(), buf, 0, headerSize);
|
30
|
+
|
31
|
+
compressor.compress(inputBL.getUnsafeBytes(), inputBL.getBegin(), srcSize, buf, headerSize);
|
32
|
+
|
33
|
+
return RubyString.newStringNoCopy(context.runtime, buf);
|
34
|
+
}
|
35
|
+
|
36
|
+
@JRubyMethod(module = true)
|
37
|
+
public static IRubyObject compress(ThreadContext context, IRubyObject self, IRubyObject _header, IRubyObject _input, IRubyObject _in_size) {
|
38
|
+
return compress_internal(context, FACTORY.fastCompressor(), _header, _input, _in_size);
|
39
|
+
}
|
40
|
+
|
41
|
+
@JRubyMethod(module = true)
|
42
|
+
public static IRubyObject compressHC(ThreadContext context, IRubyObject self, IRubyObject _header, IRubyObject _input, IRubyObject _in_size) {
|
43
|
+
return compress_internal(context, FACTORY.highCompressor(), _header, _input, _in_size);
|
44
|
+
}
|
45
|
+
|
46
|
+
@JRubyMethod(required = 4, module = true)
|
47
|
+
public static IRubyObject uncompress(ThreadContext context, IRubyObject self, IRubyObject[] args) {
|
48
|
+
RubyString input = args[0].convertToString();
|
49
|
+
RubyInteger in_size = args[1].convertToInteger();
|
50
|
+
RubyInteger header_size = args[2].convertToInteger();
|
51
|
+
RubyInteger buf_size = args[3].convertToInteger();
|
52
|
+
|
53
|
+
ByteList inputBL = input.getByteList();
|
54
|
+
int inSize = (int)in_size.getLongValue();
|
55
|
+
int headerSize = (int)header_size.getLongValue();
|
56
|
+
int bufSize = (int)buf_size.getLongValue();
|
57
|
+
|
58
|
+
byte[] buf = new byte[bufSize];
|
59
|
+
|
60
|
+
FACTORY.decompressor().decompress(inputBL.getUnsafeBytes(), inputBL.getBegin() + headerSize, buf, 0, buf.length);
|
61
|
+
|
62
|
+
return RubyString.newStringNoCopy(context.runtime, buf);
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
package com.headius.jruby.lz4;
|
2
|
+
|
3
|
+
import java.io.IOException;
|
4
|
+
import org.jruby.Ruby;
|
5
|
+
import org.jruby.RubyModule;
|
6
|
+
import org.jruby.runtime.load.Library;
|
7
|
+
|
8
|
+
public class LZ4Library implements Library {
|
9
|
+
|
10
|
+
public void load(Ruby runtime, boolean wrap) throws IOException {
|
11
|
+
RubyModule lz4Internal = runtime.defineModule("LZ4Internal");
|
12
|
+
|
13
|
+
lz4Internal.defineAnnotatedMethods(LZ4Internal.class);
|
14
|
+
|
15
|
+
lz4Internal.defineClassUnder("Error", runtime.getStandardError(), runtime.getStandardError().getAllocator());
|
16
|
+
}
|
17
|
+
|
18
|
+
}
|
metadata
CHANGED
@@ -1,107 +1,99 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: lz4-ruby
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 7
|
10
|
-
version: 0.1.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: !binary |-
|
5
|
+
MC4yLjA=
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- KOMIYA Atsushi
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
date: 2013-12-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ! '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
21
|
type: :development
|
22
|
-
name: shoulda
|
23
22
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
requirement: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
type: :development
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
36
29
|
name: rdoc
|
37
|
-
|
38
|
-
|
39
|
-
none: false
|
40
|
-
requirements:
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
41
32
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
- 3
|
46
|
-
- 12
|
47
|
-
version: "3.12"
|
48
|
-
requirement: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: !binary |-
|
35
|
+
My4xMg==
|
50
36
|
type: :development
|
51
|
-
name: bundler
|
52
37
|
prerelease: false
|
53
|
-
version_requirements:
|
54
|
-
|
55
|
-
requirements:
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
56
40
|
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
- !ruby/object:Gem::
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: !binary |-
|
43
|
+
My4xMg==
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: bundler
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
66
51
|
type: :development
|
67
|
-
name: jeweler
|
68
52
|
prerelease: false
|
69
|
-
version_requirements:
|
70
|
-
|
71
|
-
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: jeweler
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
72
62
|
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
|
76
|
-
- 1
|
77
|
-
- 8
|
78
|
-
- 3
|
79
|
-
version: 1.8.3
|
80
|
-
requirement: *id004
|
81
|
-
- !ruby/object:Gem::Dependency
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: !binary |-
|
65
|
+
MS44LjM=
|
82
66
|
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: !binary |-
|
73
|
+
MS44LjM=
|
74
|
+
- !ruby/object:Gem::Dependency
|
83
75
|
name: rake-compiler
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
type: :development
|
84
82
|
prerelease: false
|
85
|
-
version_requirements:
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
hash: 3
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
94
|
-
requirement: *id005
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
95
88
|
description: Ruby bindings for LZ4. LZ4 is a very fast lossless compression algorithm.
|
96
89
|
email: komiya.atsushi@gmail.com
|
97
90
|
executables: []
|
98
|
-
|
99
|
-
extensions:
|
91
|
+
extensions:
|
100
92
|
- ext/lz4ruby/extconf.rb
|
101
|
-
extra_rdoc_files:
|
93
|
+
extra_rdoc_files:
|
102
94
|
- LICENSE.txt
|
103
95
|
- README.rdoc
|
104
|
-
files:
|
96
|
+
files:
|
105
97
|
- .document
|
106
98
|
- Gemfile
|
107
99
|
- LICENSE.txt
|
@@ -120,41 +112,36 @@ files:
|
|
120
112
|
- ext/lz4ruby/lz4hc.c
|
121
113
|
- ext/lz4ruby/lz4hc.h
|
122
114
|
- ext/lz4ruby/lz4ruby.c
|
115
|
+
- lib/lz4-jruby.rb
|
123
116
|
- lib/lz4-ruby.rb
|
124
|
-
-
|
125
|
-
-
|
117
|
+
- pom.xml
|
118
|
+
- spec/helper.rb
|
119
|
+
- spec/lz4_compressHC_spec.rb
|
120
|
+
- spec/lz4_compress_spec.rb
|
121
|
+
- src/main/java/com/headius/jruby/lz4/LZ4Internal.java
|
122
|
+
- src/main/java/com/headius/jruby/lz4/LZ4Library.java
|
126
123
|
homepage: http://github.com/komiya-atsushi/lz4-ruby
|
127
|
-
licenses:
|
124
|
+
licenses:
|
128
125
|
- MIT
|
126
|
+
metadata: {}
|
129
127
|
post_install_message:
|
130
128
|
rdoc_options: []
|
131
|
-
|
132
|
-
require_paths:
|
129
|
+
require_paths:
|
133
130
|
- lib
|
134
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
none: false
|
145
|
-
requirements:
|
146
|
-
- - ">="
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
hash: 3
|
149
|
-
segments:
|
150
|
-
- 0
|
151
|
-
version: "0"
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
152
141
|
requirements: []
|
153
|
-
|
154
142
|
rubyforge_project:
|
155
|
-
rubygems_version: 1.
|
143
|
+
rubygems_version: 2.1.11
|
156
144
|
signing_key:
|
157
|
-
specification_version:
|
145
|
+
specification_version: 4
|
158
146
|
summary: Ruby bindings for LZ4 (Extremely Fast Compression algorithm).
|
159
147
|
test_files: []
|
160
|
-
|
data/test/test_lz4-ruby.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestLz4Ruby < Test::Unit::TestCase
|
4
|
-
LOOP_COUNT = 257
|
5
|
-
|
6
|
-
srand(123)
|
7
|
-
|
8
|
-
def self.random_bytes(len)
|
9
|
-
result = []
|
10
|
-
len.times do |t|
|
11
|
-
result << rand(256)
|
12
|
-
end
|
13
|
-
return result.pack("C*")
|
14
|
-
end
|
15
|
-
|
16
|
-
context "LZ4::compress" do
|
17
|
-
should "empty text" do
|
18
|
-
compressed = LZ4::compress("")
|
19
|
-
uncompressed = LZ4::uncompress(compressed)
|
20
|
-
assert_equal("", uncompressed)
|
21
|
-
end
|
22
|
-
|
23
|
-
should "long text" do
|
24
|
-
text = "a" * 131073
|
25
|
-
compressed = LZ4.compress(text)
|
26
|
-
uncompressed = LZ4.uncompress(compressed)
|
27
|
-
assert_equal(text, uncompressed)
|
28
|
-
end
|
29
|
-
|
30
|
-
LOOP_COUNT.times do |t|
|
31
|
-
len = t + 1
|
32
|
-
text = "a" * len
|
33
|
-
|
34
|
-
should "text of #{len} \"a\"'s" do
|
35
|
-
compressed = LZ4::compress(text)
|
36
|
-
uncompressed = LZ4::uncompress(compressed)
|
37
|
-
assert_equal(text, uncompressed)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
LOOP_COUNT.times do |t|
|
42
|
-
len = t + 1
|
43
|
-
text = random_bytes(len)
|
44
|
-
|
45
|
-
should "random text of #{len} bytes" do
|
46
|
-
compressed = LZ4::compress(text)
|
47
|
-
uncompressed = LZ4::uncompress(compressed)
|
48
|
-
assert_equal(text, uncompressed)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
text = "b" * LOOP_COUNT
|
53
|
-
LOOP_COUNT.times do |t|
|
54
|
-
len = t + 1
|
55
|
-
should "#{len} bytes substring of #{LOOP_COUNT} bytes \"b\"'s" do
|
56
|
-
compressed = LZ4::compress(text, len)
|
57
|
-
uncompressed = LZ4::uncompress(compressed)
|
58
|
-
assert_equal(text[0, len], uncompressed)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context "LZ4::compressHC" do
|
64
|
-
should "empty text" do
|
65
|
-
compressed = LZ4::compressHC("")
|
66
|
-
uncompressed = LZ4::uncompress(compressed)
|
67
|
-
assert_equal("", uncompressed)
|
68
|
-
end
|
69
|
-
|
70
|
-
should "long text" do
|
71
|
-
text = "a" * 131073
|
72
|
-
compressed = LZ4.compressHC(text)
|
73
|
-
uncompressed = LZ4.uncompress(compressed)
|
74
|
-
assert_equal(text, uncompressed)
|
75
|
-
end
|
76
|
-
|
77
|
-
LOOP_COUNT.times do |t|
|
78
|
-
len = t + 1
|
79
|
-
text = "a" * len
|
80
|
-
|
81
|
-
should "text of #{len} \"a\"'s" do
|
82
|
-
compressed = LZ4::compressHC(text)
|
83
|
-
uncompressed = LZ4::uncompress(compressed)
|
84
|
-
assert_equal(text, uncompressed)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
LOOP_COUNT.times do |t|
|
89
|
-
len = t + 1
|
90
|
-
text = random_bytes(len)
|
91
|
-
|
92
|
-
should "random text of #{len} bytes" do
|
93
|
-
compressed = LZ4::compressHC(text)
|
94
|
-
uncompressed = LZ4::uncompress(compressed)
|
95
|
-
assert_equal(text, uncompressed)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
text = "b" * LOOP_COUNT
|
100
|
-
LOOP_COUNT.times do |t|
|
101
|
-
len = t + 1
|
102
|
-
should "#{len} bytes substring of #{LOOP_COUNT} bytes \"b\"'s" do
|
103
|
-
compressed = LZ4::compressHC(text, len)
|
104
|
-
uncompressed = LZ4::uncompress(compressed)
|
105
|
-
assert_equal(text[0, len], uncompressed)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|