lz4-ruby 0.3.1-x86-mingw32 → 0.3.2-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.rdoc +9 -5
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/lib/1.8/lz4ruby.so +0 -0
- data/lib/1.9/lz4ruby.so +0 -0
- data/lib/lz4-ruby.rb +23 -20
- data/spec/lz4_compressHC_spec.rb +26 -15
- data/spec/lz4_compress_spec.rb +23 -12
- data/spec/lz4_raw_compress_spec.rb +1 -1
- data/spec/lz4_raw_decompress_spec.rb +1 -1
- metadata +20 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA512:
|
3
|
-
metadata.gz: b7c8c4031ace9a7f264e898dc540b46b5edbbd4cc8a9a9b5a94fa9c6315f66ab9a2f9e0a36625926f3cce0cf1a30cc930584a6ec38977f3f5b4e254db3a7360b
|
4
|
-
data.tar.gz: 29b2866d4403c1063aac1df854a61df93017d8d401df4172b6658e4c1d4e6ba1a77c328c9f6b9e85e2f5bbd7af6a042bd5ad1afc8d8b156a1a592c552b527bb8
|
5
2
|
SHA1:
|
6
|
-
|
7
|
-
|
3
|
+
data.tar.gz: ae57034ee26f014d90674e7123ce29aaa9c6f203
|
4
|
+
metadata.gz: 24241cb6aae911d4417cf25f9da0244850cacab9
|
5
|
+
SHA512:
|
6
|
+
data.tar.gz: e38ca811d78b40ad6c2eda4003d7238e4a24f99995aa582a2574c279f99d06fb2e48fcebb1e56264c8858d566d2dcae5ea15504dd794bf6d659a7d0e60ebd548
|
7
|
+
metadata.gz: 16b2b3f4990285e807ad742123844db6faa601b8227fef9cba77a30d75e50c7f71b9b7e4e82ade61f49553639a098acd47492f12e1f105e1ab221cad43857ab1
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
= ChangeLog
|
2
2
|
|
3
|
+
== 0.3.1
|
4
|
+
|
5
|
+
* Support raw data handling methods in JRuby
|
6
|
+
|
3
7
|
== 0.3.0
|
4
8
|
|
5
|
-
* Support raw data
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
* Rename
|
9
|
+
* Support raw data handling methods (but not worked in JRuby).
|
10
|
+
* LZ4.Raw.compress()
|
11
|
+
* LZ4.Raw.compressHC()
|
12
|
+
* LZ4.Raw.decompress()
|
13
|
+
* Rename LZ4.uncompress() to LZ4.decompress().
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/1.8/lz4ruby.so
CHANGED
Binary file
|
data/lib/1.9/lz4ruby.so
CHANGED
Binary file
|
data/lib/lz4-ruby.rb
CHANGED
@@ -17,15 +17,18 @@ class LZ4
|
|
17
17
|
return _compress(input, in_size, true)
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.decompress(input, in_size = nil)
|
21
|
-
in_size = input.
|
20
|
+
def self.decompress(input, in_size = nil, encoding = nil)
|
21
|
+
in_size = input.bytesize if in_size == nil
|
22
22
|
out_size, varbyte_len = decode_varbyte(input)
|
23
23
|
|
24
24
|
if out_size < 0 || varbyte_len < 0
|
25
25
|
raise "Compressed data is maybe corrupted"
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
result = LZ4Internal::uncompress(input, in_size, varbyte_len, out_size)
|
29
|
+
result.force_encoding(encoding) if encoding != nil
|
30
|
+
|
31
|
+
return result
|
29
32
|
end
|
30
33
|
|
31
34
|
# @deprecated Use {#decompress} and will be removed.
|
@@ -35,7 +38,7 @@ class LZ4
|
|
35
38
|
|
36
39
|
private
|
37
40
|
def self._compress(input, in_size, high_compression)
|
38
|
-
in_size = input.
|
41
|
+
in_size = input.bytesize if in_size == nil
|
39
42
|
header = encode_varbyte(in_size)
|
40
43
|
|
41
44
|
if high_compression
|
@@ -66,7 +69,7 @@ class LZ4
|
|
66
69
|
|
67
70
|
private
|
68
71
|
def self.decode_varbyte(text)
|
69
|
-
len = [text.
|
72
|
+
len = [text.bytesize, 5].min
|
70
73
|
bytes = text[0, len].unpack("C*")
|
71
74
|
|
72
75
|
varbyte_len = 0
|
@@ -86,7 +89,7 @@ class LZ4
|
|
86
89
|
#
|
87
90
|
# @param [String] source string to be compressed
|
88
91
|
# @param [Hash] options
|
89
|
-
# @option options [Fixnum] :input_size
|
92
|
+
# @option options [Fixnum] :input_size byte size of source to compress (must be less than or equal to `source.bytesize`)
|
90
93
|
# @option options [String] :dest output buffer which will receive compressed string
|
91
94
|
# @option options [Fixnum] :max_output_size acceptable maximum output size
|
92
95
|
# @return [String, Fixnum] compressed string and its length.
|
@@ -98,7 +101,7 @@ class LZ4
|
|
98
101
|
#
|
99
102
|
# @param [String] source string to be compressed
|
100
103
|
# @param [Hash] options
|
101
|
-
# @option options [Fixnum] :input_size
|
104
|
+
# @option options [Fixnum] :input_size byte size of source to compress (must be less than or equal to `source.bytesize`)
|
102
105
|
# @option options [String] :dest output buffer which will receive compressed string
|
103
106
|
# @option options [Fixnum] :max_output_size acceptable maximum output size
|
104
107
|
# @return [String, Fixnum] compressed string and its length.
|
@@ -106,15 +109,15 @@ class LZ4
|
|
106
109
|
return _compress(source, true, options)
|
107
110
|
end
|
108
111
|
|
109
|
-
private
|
112
|
+
private
|
110
113
|
def self._compress(source, high_compression, options = {})
|
111
114
|
input_size = options[:input_size]
|
112
115
|
if input_size == nil
|
113
|
-
input_size = source.
|
116
|
+
input_size = source.bytesize
|
114
117
|
|
115
118
|
else
|
116
|
-
if source.
|
117
|
-
raise ArgumentError, "`:input_size` (#{input_size}) must be less than or equal `source.
|
119
|
+
if source.bytesize < input_size
|
120
|
+
raise ArgumentError, "`:input_size` (#{input_size}) must be less than or equal `source.bytesize` (#{source.bytesize})"
|
118
121
|
end
|
119
122
|
end
|
120
123
|
|
@@ -123,14 +126,14 @@ class LZ4
|
|
123
126
|
max_output_size = options[:max_output_size]
|
124
127
|
if max_output_size == nil
|
125
128
|
if dest != nil
|
126
|
-
max_output_size = dest.
|
129
|
+
max_output_size = dest.bytesize
|
127
130
|
else
|
128
131
|
max_output_size = input_size + (input_size / 255) + 16 if dest == nil
|
129
132
|
end
|
130
133
|
|
131
134
|
else
|
132
|
-
if dest != nil && dest.
|
133
|
-
raise ArgumentError, "`:dest` buffer size (#{dest.
|
135
|
+
if dest != nil && dest.bytesize < max_output_size
|
136
|
+
raise ArgumentError, "`:dest` buffer size (#{dest.bytesize}) must be greater than or equal `:max_output_size` (#{max_output_size})"
|
134
137
|
end
|
135
138
|
end
|
136
139
|
|
@@ -153,24 +156,24 @@ class LZ4
|
|
153
156
|
# @param [String] source
|
154
157
|
# @param [Fixnum] max_output_size
|
155
158
|
# @param [Hash] options
|
156
|
-
# @option options [Fixnum] :input_size
|
159
|
+
# @option options [Fixnum] :input_size byte size of source to decompress (must be less than or equal to `source.bytesize`)
|
157
160
|
# @option options [String] :dest output buffer which will receive decompressed string
|
158
161
|
# @return [String, Fixnum] decompressed string and its length.
|
159
162
|
def self.decompress(source, max_output_size, options = {})
|
160
163
|
input_size = options[:input_size]
|
161
164
|
if input_size == nil
|
162
|
-
input_size = source.
|
165
|
+
input_size = source.bytesize
|
163
166
|
|
164
167
|
else
|
165
|
-
if source.
|
166
|
-
raise ArgumentError, "`:input_size` (#{input_size}) must be less than or equal `source.
|
168
|
+
if source.bytesize < input_size
|
169
|
+
raise ArgumentError, "`:input_size` (#{input_size}) must be less than or equal `source.bytesize` (#{source.bytesize})"
|
167
170
|
end
|
168
171
|
end
|
169
172
|
|
170
173
|
dest = options[:dest]
|
171
174
|
|
172
|
-
if dest != nil && dest.
|
173
|
-
raise ArgumentError, "`:dest` buffer size (#{dest.
|
175
|
+
if dest != nil && dest.bytesize < max_output_size
|
176
|
+
raise ArgumentError, "`:dest` buffer size (#{dest.bytesize}) must be greater than or equal `max_output_size` (#{max_output_size})"
|
174
177
|
end
|
175
178
|
|
176
179
|
result = LZ4Internal.decompress_raw(source, input_size, dest, max_output_size)
|
data/spec/lz4_compressHC_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
require './spec/helper'
|
2
4
|
|
3
5
|
describe "LZ4::compress" do
|
@@ -5,24 +7,24 @@ describe "LZ4::compress" do
|
|
5
7
|
|
6
8
|
context "give empty text" do
|
7
9
|
compressed = LZ4.compressHC("")
|
8
|
-
|
10
|
+
decompressed = LZ4.decompress(compressed)
|
9
11
|
|
10
|
-
it "should be able to
|
11
|
-
expect(
|
12
|
+
it "should be able to decompress" do
|
13
|
+
expect(decompressed).to eql("")
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
context "give long text" do
|
16
18
|
text = "a" * 131073
|
17
19
|
compressed = LZ4.compressHC(text)
|
18
|
-
|
20
|
+
decompressed = LZ4.decompress(compressed)
|
19
21
|
|
20
22
|
it "should be compressed length less than original text" do
|
21
|
-
expect(compressed.
|
23
|
+
expect(compressed.bytesize).to be < text.bytesize
|
22
24
|
end
|
23
25
|
|
24
|
-
it "should be able to
|
25
|
-
expect(
|
26
|
+
it "should be able to decompress" do
|
27
|
+
expect(decompressed).to eql(text)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
@@ -32,12 +34,12 @@ describe "LZ4::compress" do
|
|
32
34
|
|
33
35
|
context "give text of #{len} \"a\"'s" do
|
34
36
|
compressed = LZ4.compressHC(text)
|
35
|
-
|
36
|
-
it "should be able to
|
37
|
-
expect(
|
37
|
+
decompressed = LZ4.decompress(compressed)
|
38
|
+
it "should be able to decompress" do
|
39
|
+
expect(decompressed).to eql(text)
|
38
40
|
end
|
39
41
|
end
|
40
|
-
end
|
42
|
+
end
|
41
43
|
|
42
44
|
LOOP_COUNT.times do |t|
|
43
45
|
len = t + 1
|
@@ -45,10 +47,19 @@ describe "LZ4::compress" do
|
|
45
47
|
|
46
48
|
context "give text of #{len} bytes" do
|
47
49
|
compressed = LZ4.compressHC(text)
|
48
|
-
|
49
|
-
it "should be able to
|
50
|
-
expect(
|
50
|
+
decompressed = LZ4.decompress(compressed)
|
51
|
+
it "should be able to decompress" do
|
52
|
+
expect(decompressed).to eql(text)
|
51
53
|
end
|
52
54
|
end
|
53
|
-
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "give UTF-8 text" do
|
58
|
+
text = "いろはにほへと"
|
59
|
+
compressed = LZ4.compressHC(text)
|
60
|
+
decompressed = LZ4.decompress(compressed, compressed.bytesize, "UTF-8")
|
61
|
+
it "should be able to decompress" do
|
62
|
+
expect(decompressed).to eql(text)
|
63
|
+
end
|
64
|
+
end
|
54
65
|
end
|
data/spec/lz4_compress_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
require './spec/helper'
|
2
4
|
|
3
5
|
describe "LZ4::compress" do
|
@@ -5,24 +7,24 @@ describe "LZ4::compress" do
|
|
5
7
|
|
6
8
|
context "give empty text" do
|
7
9
|
compressed = LZ4.compress("")
|
8
|
-
|
10
|
+
decompressed = LZ4.decompress(compressed)
|
9
11
|
|
10
|
-
it "should be able to
|
11
|
-
expect(
|
12
|
+
it "should be able to decompress" do
|
13
|
+
expect(decompressed).to eql("")
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
context "give long text" do
|
16
18
|
text = "a" * 131073
|
17
19
|
compressed = LZ4.compress(text)
|
18
|
-
|
20
|
+
decompressed = LZ4.decompress(compressed)
|
19
21
|
|
20
22
|
it "should be compressed length less than original text" do
|
21
23
|
expect(compressed.size).to be < text.length
|
22
24
|
end
|
23
25
|
|
24
|
-
it "should be able to
|
25
|
-
expect(
|
26
|
+
it "should be able to decompress" do
|
27
|
+
expect(decompressed).to eql(text)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
@@ -32,9 +34,9 @@ describe "LZ4::compress" do
|
|
32
34
|
|
33
35
|
context "give text of #{len} \"a\"'s" do
|
34
36
|
compressed = LZ4.compress(text)
|
35
|
-
|
36
|
-
it "should be able to
|
37
|
-
expect(
|
37
|
+
decompressed = LZ4.decompress(compressed)
|
38
|
+
it "should be able to decompress" do
|
39
|
+
expect(decompressed).to eql(text)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -45,10 +47,19 @@ describe "LZ4::compress" do
|
|
45
47
|
|
46
48
|
context "give text of #{len} bytes" do
|
47
49
|
compressed = LZ4.compress(text)
|
48
|
-
|
49
|
-
it "should be able to
|
50
|
-
expect(
|
50
|
+
decompressed = LZ4.decompress(compressed)
|
51
|
+
it "should be able to decompress" do
|
52
|
+
expect(decompressed).to eql(text)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
56
|
+
|
57
|
+
context "give UTF-8 text" do
|
58
|
+
text = "いろはにほへと"
|
59
|
+
compressed = LZ4.compress(text)
|
60
|
+
decompressed = LZ4.decompress(compressed, compressed.bytesize, "UTF-8")
|
61
|
+
it "should be able to decompress" do
|
62
|
+
expect(decompressed).to eql(text)
|
63
|
+
end
|
64
|
+
end
|
54
65
|
end
|
@@ -54,7 +54,7 @@ describe "LZ4::Raw::compress" do
|
|
54
54
|
it "should be thrown ArgumentError" do
|
55
55
|
expect {
|
56
56
|
compressed, size = LZ4::Raw.compress(text, :input_size => input_size)
|
57
|
-
}.to raise_error(ArgumentError, "`:input_size` (30) must be less than or equal `source.
|
57
|
+
}.to raise_error(ArgumentError, "`:input_size` (30) must be less than or equal `source.bytesize` (20)")
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -55,7 +55,7 @@ describe "LZ4::Raw.decompress" do
|
|
55
55
|
it "should be thrown ArgumentError" do
|
56
56
|
expect {
|
57
57
|
decompressed, size = LZ4::Raw.decompress(compressed.pack("C*"), 30, :input_size => input_size)
|
58
|
-
}.to raise_error ArgumentError, "`:input_size` (20) must be less than or equal `source.
|
58
|
+
}.to raise_error ArgumentError, "`:input_size` (20) must be less than or equal `source.bytesize` (#{compressed.length})"
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lz4-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- KOMIYA Atsushi
|
@@ -9,55 +9,55 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-22 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
|
16
|
+
prerelease: false
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
18
|
requirements:
|
18
19
|
- &id003
|
19
20
|
- ">="
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: "0"
|
22
|
-
prerelease: false
|
23
|
-
requirement: *id001
|
24
23
|
type: :development
|
24
|
+
version_requirements: *id001
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
|
27
|
+
prerelease: false
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
29
|
requirements:
|
29
30
|
- - ~>
|
30
31
|
- !ruby/object:Gem::Version
|
31
32
|
version: "3.12"
|
32
|
-
prerelease: false
|
33
|
-
requirement: *id002
|
34
33
|
type: :development
|
34
|
+
version_requirements: *id002
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: bundler
|
37
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
40
|
- *id003
|
40
|
-
prerelease: false
|
41
|
-
requirement: *id004
|
42
41
|
type: :development
|
42
|
+
version_requirements: *id004
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: jeweler
|
45
|
-
|
45
|
+
prerelease: false
|
46
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
46
47
|
requirements:
|
47
48
|
- - ~>
|
48
49
|
- !ruby/object:Gem::Version
|
49
50
|
version: 1.8.3
|
50
|
-
prerelease: false
|
51
|
-
requirement: *id005
|
52
51
|
type: :development
|
52
|
+
version_requirements: *id005
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake-compiler
|
55
|
-
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
56
57
|
requirements:
|
57
58
|
- *id003
|
58
|
-
prerelease: false
|
59
|
-
requirement: *id006
|
60
59
|
type: :development
|
60
|
+
version_requirements: *id006
|
61
61
|
description: Ruby bindings for LZ4. LZ4 is a very fast lossless compression algorithm.
|
62
62
|
email: komiya.atsushi@gmail.com
|
63
63
|
executables: []
|
@@ -112,7 +112,9 @@ require_paths:
|
|
112
112
|
- lib
|
113
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
-
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: "1.9"
|
116
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
119
|
requirements:
|
118
120
|
- *id003
|