msgpack 0.6.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +26 -0
- data/ChangeLog +129 -0
- data/Dockerfile +62 -0
- data/LICENSE +177 -0
- data/README.rdoc +141 -0
- data/Rakefile +68 -0
- data/bench/pack.rb +23 -0
- data/bench/pack_log.rb +33 -0
- data/bench/pack_log_long.rb +65 -0
- data/bench/run.sh +14 -0
- data/bench/run_long.sh +35 -0
- data/bench/unpack.rb +21 -0
- data/bench/unpack_log.rb +34 -0
- data/bench/unpack_log_long.rb +67 -0
- data/doclib/msgpack.rb +77 -0
- data/doclib/msgpack/buffer.rb +193 -0
- data/doclib/msgpack/core_ext.rb +101 -0
- data/doclib/msgpack/error.rb +14 -0
- data/doclib/msgpack/packer.rb +134 -0
- data/doclib/msgpack/unpacker.rb +146 -0
- data/ext/java/org/msgpack/jruby/Buffer.java +221 -0
- data/ext/java/org/msgpack/jruby/Decoder.java +201 -0
- data/ext/java/org/msgpack/jruby/Encoder.java +308 -0
- data/ext/java/org/msgpack/jruby/ExtensionValue.java +136 -0
- data/ext/java/org/msgpack/jruby/MessagePackLibrary.java +107 -0
- data/ext/java/org/msgpack/jruby/Packer.java +78 -0
- data/ext/java/org/msgpack/jruby/Types.java +37 -0
- data/ext/java/org/msgpack/jruby/Unpacker.java +170 -0
- data/ext/msgpack/buffer.c +695 -0
- data/ext/msgpack/buffer.h +447 -0
- data/ext/msgpack/buffer_class.c +507 -0
- data/ext/msgpack/buffer_class.h +32 -0
- data/ext/msgpack/compat.h +114 -0
- data/ext/msgpack/core_ext.c +129 -0
- data/ext/msgpack/core_ext.h +26 -0
- data/ext/msgpack/extconf.rb +30 -0
- data/ext/msgpack/packer.c +168 -0
- data/ext/msgpack/packer.h +441 -0
- data/ext/msgpack/packer_class.c +302 -0
- data/ext/msgpack/packer_class.h +30 -0
- data/ext/msgpack/rbinit.c +33 -0
- data/ext/msgpack/rmem.c +94 -0
- data/ext/msgpack/rmem.h +109 -0
- data/ext/msgpack/sysdep.h +115 -0
- data/ext/msgpack/sysdep_endian.h +50 -0
- data/ext/msgpack/sysdep_types.h +46 -0
- data/ext/msgpack/unpacker.c +771 -0
- data/ext/msgpack/unpacker.h +122 -0
- data/ext/msgpack/unpacker_class.c +405 -0
- data/ext/msgpack/unpacker_class.h +32 -0
- data/lib/msgpack.rb +13 -0
- data/lib/msgpack/version.rb +3 -0
- data/msgpack.gemspec +31 -0
- data/msgpack.org.md +46 -0
- data/spec/cases.json +1 -0
- data/spec/cases.msg +0 -0
- data/spec/cases_compact.msg +0 -0
- data/spec/cases_spec.rb +39 -0
- data/spec/cruby/buffer_io_spec.rb +256 -0
- data/spec/cruby/buffer_packer.rb +29 -0
- data/spec/cruby/buffer_spec.rb +572 -0
- data/spec/cruby/buffer_unpacker.rb +19 -0
- data/spec/cruby/packer_spec.rb +120 -0
- data/spec/cruby/unpacker_spec.rb +305 -0
- data/spec/format_spec.rb +282 -0
- data/spec/jruby/benchmarks/shootout_bm.rb +73 -0
- data/spec/jruby/benchmarks/symbolize_keys_bm.rb +25 -0
- data/spec/jruby/msgpack/unpacker_spec.rb +290 -0
- data/spec/jruby/msgpack_spec.rb +142 -0
- data/spec/pack_spec.rb +67 -0
- data/spec/random_compat.rb +24 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/unpack_spec.rb +60 -0
- metadata +208 -0
data/spec/pack_spec.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
require 'stringio'
|
5
|
+
if defined?(Encoding)
|
6
|
+
Encoding.default_external = 'ASCII-8BIT'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe MessagePack do
|
10
|
+
it 'to_msgpack returns String' do
|
11
|
+
nil.to_msgpack.class.should == String
|
12
|
+
true.to_msgpack.class.should == String
|
13
|
+
false.to_msgpack.class.should == String
|
14
|
+
1.to_msgpack.class.should == String
|
15
|
+
1.0.to_msgpack.class.should == String
|
16
|
+
"".to_msgpack.class.should == String
|
17
|
+
Hash.new.to_msgpack.class.should == String
|
18
|
+
Array.new.to_msgpack.class.should == String
|
19
|
+
end
|
20
|
+
|
21
|
+
class CustomPack01
|
22
|
+
def to_msgpack(pk=nil)
|
23
|
+
return MessagePack.pack(self, pk) unless pk.class == MessagePack::Packer
|
24
|
+
pk.write_array_header(2)
|
25
|
+
pk.write(1)
|
26
|
+
pk.write(2)
|
27
|
+
return pk
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class CustomPack02
|
32
|
+
def to_msgpack(pk=nil)
|
33
|
+
[1,2].to_msgpack(pk)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'calls custom to_msgpack method' do
|
38
|
+
if /java/ =~ RUBY_PLATFORM
|
39
|
+
skip "custom to_msgpack fallback is not supported yet in JRuby implementation"
|
40
|
+
end
|
41
|
+
MessagePack.pack(CustomPack01.new).should == [1,2].to_msgpack
|
42
|
+
MessagePack.pack(CustomPack02.new).should == [1,2].to_msgpack
|
43
|
+
CustomPack01.new.to_msgpack.should == [1,2].to_msgpack
|
44
|
+
CustomPack02.new.to_msgpack.should == [1,2].to_msgpack
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'calls custom to_msgpack method with io' do
|
48
|
+
if /java/ =~ RUBY_PLATFORM
|
49
|
+
skip "custom to_msgpack fallback with io is not supported yet in JRuby implementation"
|
50
|
+
end
|
51
|
+
s01 = StringIO.new
|
52
|
+
MessagePack.pack(CustomPack01.new, s01)
|
53
|
+
s01.string.should == [1,2].to_msgpack
|
54
|
+
|
55
|
+
s02 = StringIO.new
|
56
|
+
MessagePack.pack(CustomPack02.new, s02)
|
57
|
+
s02.string.should == [1,2].to_msgpack
|
58
|
+
|
59
|
+
s03 = StringIO.new
|
60
|
+
CustomPack01.new.to_msgpack(s03)
|
61
|
+
s03.string.should == [1,2].to_msgpack
|
62
|
+
|
63
|
+
s04 = StringIO.new
|
64
|
+
CustomPack02.new.to_msgpack(s04)
|
65
|
+
s04.string.should == [1,2].to_msgpack
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
unless defined? Random
|
3
|
+
class Random
|
4
|
+
def initialize(seed=Time.now.to_i)
|
5
|
+
Kernel.srand(seed)
|
6
|
+
@seed = seed
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :seed
|
10
|
+
|
11
|
+
def rand(arg)
|
12
|
+
Kernel.rand(arg)
|
13
|
+
end
|
14
|
+
|
15
|
+
def bytes(n)
|
16
|
+
array = []
|
17
|
+
n.times do
|
18
|
+
array << rand(256)
|
19
|
+
end
|
20
|
+
array.pack('C*')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
if ENV['SIMPLE_COV']
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter 'spec/'
|
6
|
+
add_filter 'pkg/'
|
7
|
+
add_filter 'vendor/'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
if ENV['GC_STRESS']
|
12
|
+
puts "enable GC.stress"
|
13
|
+
GC.stress = true
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'msgpack'
|
17
|
+
|
18
|
+
if /java/ =~ RUBY_PLATFORM
|
19
|
+
RSpec.configure do |c|
|
20
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
21
|
+
c.filter_run_excluding :encodings => !(defined? Encoding)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
Packer = MessagePack::Packer
|
25
|
+
Unpacker = MessagePack::Unpacker
|
26
|
+
Buffer = MessagePack::Buffer
|
27
|
+
end
|
data/spec/unpack_spec.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
require 'stringio'
|
5
|
+
if defined?(Encoding)
|
6
|
+
Encoding.default_external = 'ASCII-8BIT'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe MessagePack do
|
10
|
+
it 'MessagePack.unpack symbolize_keys' do
|
11
|
+
symbolized_hash = {:a => 'b', :c => 'd'}
|
12
|
+
MessagePack.load(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash
|
13
|
+
MessagePack.unpack(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'Unpacker#unpack symbolize_keys' do
|
17
|
+
if /java/ =~ RUBY_PLATFORM
|
18
|
+
skip "Unpacker#unpack returns nil in JRuby (incompatible)"
|
19
|
+
end
|
20
|
+
unpacker = MessagePack::Unpacker.new(:symbolize_keys => true)
|
21
|
+
symbolized_hash = {:a => 'b', :c => 'd'}
|
22
|
+
unpacker.feed(MessagePack.pack(symbolized_hash)).read.should == symbolized_hash
|
23
|
+
end
|
24
|
+
|
25
|
+
it "msgpack str 8 type" do
|
26
|
+
MessagePack.unpack([0xd9, 0x00].pack('C*')).should == ""
|
27
|
+
MessagePack.unpack([0xd9, 0x01].pack('C*') + 'a').should == "a"
|
28
|
+
MessagePack.unpack([0xd9, 0x02].pack('C*') + 'aa').should == "aa"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "msgpack str 16 type" do
|
32
|
+
MessagePack.unpack([0xda, 0x00, 0x00].pack('C*')).should == ""
|
33
|
+
MessagePack.unpack([0xda, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
34
|
+
MessagePack.unpack([0xda, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "msgpack str 32 type" do
|
38
|
+
MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
|
39
|
+
MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
40
|
+
MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "msgpack bin 8 type" do
|
44
|
+
MessagePack.unpack([0xc4, 0x00].pack('C*')).should == ""
|
45
|
+
MessagePack.unpack([0xc4, 0x01].pack('C*') + 'a').should == "a"
|
46
|
+
MessagePack.unpack([0xc4, 0x02].pack('C*') + 'aa').should == "aa"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "msgpack bin 16 type" do
|
50
|
+
MessagePack.unpack([0xc5, 0x00, 0x00].pack('C*')).should == ""
|
51
|
+
MessagePack.unpack([0xc5, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
52
|
+
MessagePack.unpack([0xc5, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "msgpack bin 32 type" do
|
56
|
+
MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
|
57
|
+
MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
58
|
+
MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
59
|
+
end
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: msgpack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.0
|
5
|
+
platform: x86-mswin32-60
|
6
|
+
authors:
|
7
|
+
- Sadayuki Furuhashi
|
8
|
+
- Theo Hultberg
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.9.2
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.9.2
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake-compiler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.8.3
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.8.3
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.11'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.11'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: json
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.7'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.7'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: yard
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.8.2
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.8.2
|
98
|
+
description: MessagePack is a binary-based efficient object serialization library.
|
99
|
+
It enables to exchange structured objects between many languages like JSON. But
|
100
|
+
unlike JSON, it is very fast and small.
|
101
|
+
email:
|
102
|
+
- frsyuki@gmail.com
|
103
|
+
- theo@iconara.net
|
104
|
+
executables: []
|
105
|
+
extensions: []
|
106
|
+
extra_rdoc_files: []
|
107
|
+
files:
|
108
|
+
- ".gitignore"
|
109
|
+
- ".travis.yml"
|
110
|
+
- ChangeLog
|
111
|
+
- Dockerfile
|
112
|
+
- Gemfile
|
113
|
+
- LICENSE
|
114
|
+
- README.rdoc
|
115
|
+
- Rakefile
|
116
|
+
- bench/pack.rb
|
117
|
+
- bench/pack_log.rb
|
118
|
+
- bench/pack_log_long.rb
|
119
|
+
- bench/run.sh
|
120
|
+
- bench/run_long.sh
|
121
|
+
- bench/unpack.rb
|
122
|
+
- bench/unpack_log.rb
|
123
|
+
- bench/unpack_log_long.rb
|
124
|
+
- doclib/msgpack.rb
|
125
|
+
- doclib/msgpack/buffer.rb
|
126
|
+
- doclib/msgpack/core_ext.rb
|
127
|
+
- doclib/msgpack/error.rb
|
128
|
+
- doclib/msgpack/packer.rb
|
129
|
+
- doclib/msgpack/unpacker.rb
|
130
|
+
- ext/java/org/msgpack/jruby/Buffer.java
|
131
|
+
- ext/java/org/msgpack/jruby/Decoder.java
|
132
|
+
- ext/java/org/msgpack/jruby/Encoder.java
|
133
|
+
- ext/java/org/msgpack/jruby/ExtensionValue.java
|
134
|
+
- ext/java/org/msgpack/jruby/MessagePackLibrary.java
|
135
|
+
- ext/java/org/msgpack/jruby/Packer.java
|
136
|
+
- ext/java/org/msgpack/jruby/Types.java
|
137
|
+
- ext/java/org/msgpack/jruby/Unpacker.java
|
138
|
+
- ext/msgpack/buffer.c
|
139
|
+
- ext/msgpack/buffer.h
|
140
|
+
- ext/msgpack/buffer_class.c
|
141
|
+
- ext/msgpack/buffer_class.h
|
142
|
+
- ext/msgpack/compat.h
|
143
|
+
- ext/msgpack/core_ext.c
|
144
|
+
- ext/msgpack/core_ext.h
|
145
|
+
- ext/msgpack/extconf.rb
|
146
|
+
- ext/msgpack/packer.c
|
147
|
+
- ext/msgpack/packer.h
|
148
|
+
- ext/msgpack/packer_class.c
|
149
|
+
- ext/msgpack/packer_class.h
|
150
|
+
- ext/msgpack/rbinit.c
|
151
|
+
- ext/msgpack/rmem.c
|
152
|
+
- ext/msgpack/rmem.h
|
153
|
+
- ext/msgpack/sysdep.h
|
154
|
+
- ext/msgpack/sysdep_endian.h
|
155
|
+
- ext/msgpack/sysdep_types.h
|
156
|
+
- ext/msgpack/unpacker.c
|
157
|
+
- ext/msgpack/unpacker.h
|
158
|
+
- ext/msgpack/unpacker_class.c
|
159
|
+
- ext/msgpack/unpacker_class.h
|
160
|
+
- lib/msgpack.rb
|
161
|
+
- lib/msgpack/msgpack.so
|
162
|
+
- lib/msgpack/version.rb
|
163
|
+
- msgpack.gemspec
|
164
|
+
- msgpack.org.md
|
165
|
+
- spec/cases.json
|
166
|
+
- spec/cases.msg
|
167
|
+
- spec/cases_compact.msg
|
168
|
+
- spec/cases_spec.rb
|
169
|
+
- spec/cruby/buffer_io_spec.rb
|
170
|
+
- spec/cruby/buffer_packer.rb
|
171
|
+
- spec/cruby/buffer_spec.rb
|
172
|
+
- spec/cruby/buffer_unpacker.rb
|
173
|
+
- spec/cruby/packer_spec.rb
|
174
|
+
- spec/cruby/unpacker_spec.rb
|
175
|
+
- spec/format_spec.rb
|
176
|
+
- spec/jruby/benchmarks/shootout_bm.rb
|
177
|
+
- spec/jruby/benchmarks/symbolize_keys_bm.rb
|
178
|
+
- spec/jruby/msgpack/unpacker_spec.rb
|
179
|
+
- spec/jruby/msgpack_spec.rb
|
180
|
+
- spec/pack_spec.rb
|
181
|
+
- spec/random_compat.rb
|
182
|
+
- spec/spec_helper.rb
|
183
|
+
- spec/unpack_spec.rb
|
184
|
+
homepage: http://msgpack.org/
|
185
|
+
licenses:
|
186
|
+
- Apache 2.0
|
187
|
+
metadata: {}
|
188
|
+
post_install_message:
|
189
|
+
rdoc_options: []
|
190
|
+
require_paths:
|
191
|
+
- lib
|
192
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
requirements: []
|
203
|
+
rubyforge_project: msgpack
|
204
|
+
rubygems_version: 2.4.5
|
205
|
+
signing_key:
|
206
|
+
specification_version: 4
|
207
|
+
summary: MessagePack, a binary-based efficient data interchange format.
|
208
|
+
test_files: []
|