msgpack 0.7.1-java → 0.7.2dev1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f104acf790f0b8dae314e3357dec2e0cdcaabb30
4
- data.tar.gz: b4b4467691d56ebe036bb368458e2520988e7637
3
+ metadata.gz: e48a3b924c24d644705dadfb6308eca40c6a137d
4
+ data.tar.gz: ca6467f9f22b0e6e23910cfe6c8c2ccca3f4b637
5
5
  SHA512:
6
- metadata.gz: ee4738586a4122fe0c6037db59c23f69b8322afe22d8b84da0d37f92e97d03f632efac55925139b342486a415ec93e684a5e3a118ed3eddc49925a42882de50e
7
- data.tar.gz: efa2e7608574a13e4f2adba873bc5c32b24b467c3411478e3383ea72cb789917f59b1c51d6a929a00573edf6c40ab9755c9d0c8276d9d6d0b7c638299336e68c
6
+ metadata.gz: 7181733fe19e4083bb9f72d29e64bb77217272bd8c3d78a8ef192789f81ea394901fdffa0aa87a18a2897b4f638e28e4a46cbd6a96961f6d677ae4ca35b18736
7
+ data.tar.gz: 9978b7568bc18a22271767d0a8b290370c68c9699d4220cab1f062f0b3568ec94269e3d0edb2c444ccbae32b1683d965ad9c140317676c8b0b2eb4e1419e6833
Binary file
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2dev1"
3
3
  end
@@ -2,6 +2,9 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  require 'stringio'
5
+ require 'tempfile'
6
+ require 'zlib'
7
+
5
8
  if defined?(Encoding)
6
9
  Encoding.default_external = 'ASCII-8BIT'
7
10
  end
@@ -19,6 +22,80 @@ describe MessagePack::Packer do
19
22
  MessagePack::Packer.new(StringIO.new, {})
20
23
  end
21
24
 
25
+ it 'gets IO or object which has #write to write/append data to it' do
26
+ sample_data = {"message" => "morning!", "num" => 1}
27
+ sample_packed = MessagePack.pack(sample_data)
28
+
29
+ Tempfile.open("for_io") do |file|
30
+ file.sync = true
31
+ p1 = MessagePack::Packer.new(file)
32
+ p1.write sample_data
33
+ p1.flush
34
+
35
+ file.rewind
36
+ expect(file.read).to eql(sample_packed)
37
+ file.unlink
38
+ end
39
+
40
+ dio = StringIO.new
41
+ p2 = MessagePack::Packer.new(dio)
42
+ p2.write sample_data
43
+ p2.flush
44
+ dio.rewind
45
+ expect(dio.string).to eql(sample_packed)
46
+
47
+ unless defined? JRUBY_VERSION
48
+ # JRuby seems to have bug not to flush GzipWriter buffer correctly (both of 1.7 and 9.0)
49
+ dio = StringIO.new
50
+ writer = Zlib::GzipWriter.new(dio)
51
+ writer.sync = true
52
+ p3 = MessagePack::Packer.new(writer)
53
+ p3.write sample_data
54
+ p3.flush
55
+ writer.flush(Zlib::FINISH)
56
+ writer.close
57
+ dio.rewind
58
+ compressed = dio.string
59
+ str = Zlib::GzipReader.wrap(StringIO.new(compressed)){|gz| gz.read }
60
+ expect(str).to eql(sample_packed)
61
+ end
62
+
63
+ class DummyIO
64
+ def initialize
65
+ @buf = "".force_encoding('ASCII-8BIT')
66
+ @pos = 0
67
+ end
68
+ def write(val)
69
+ @buf << val.to_s
70
+ end
71
+ def read(length=nil,outbuf="")
72
+ if @pos == @buf.size
73
+ nil
74
+ elsif length.nil?
75
+ val = @buf[@pos..(@buf.size)]
76
+ @pos = @buf.size
77
+ outbuf << val
78
+ outbuf
79
+ else
80
+ val = @buf[@pos..(@pos + length)]
81
+ @pos += val.size
82
+ @pos = @buf.size if @pos > @buf.size
83
+ outbuf << val
84
+ outbuf
85
+ end
86
+ end
87
+ def flush
88
+ # nop
89
+ end
90
+ end
91
+
92
+ dio = DummyIO.new
93
+ p4 = MessagePack::Packer.new(dio)
94
+ p4.write sample_data
95
+ p4.flush
96
+ expect(dio.read).to eql(sample_packed)
97
+ end
98
+
22
99
  it 'gets options to specify how to pack values' do
23
100
  u1 = MessagePack::Packer.new
24
101
  u1.compatibility_mode?.should == false
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'stringio'
4
4
  require 'tempfile'
5
+ require 'zlib'
5
6
 
6
7
  require 'spec_helper'
7
8
 
@@ -24,6 +25,73 @@ describe MessagePack::Unpacker do
24
25
  u2.allow_unknown_ext?.should == true
25
26
  end
26
27
 
28
+ it 'gets IO or object which has #read to read data from it' do
29
+ sample_data = {"message" => "morning!", "num" => 1}
30
+ sample_packed = MessagePack.pack(sample_data).force_encoding('ASCII-8BIT')
31
+
32
+ Tempfile.open("for_io") do |file|
33
+ file.sync = true
34
+ file.write sample_packed
35
+ file.rewind
36
+
37
+ u1 = MessagePack::Unpacker.new(file)
38
+ u1.each do |obj|
39
+ expect(obj).to eql(sample_data)
40
+ end
41
+ file.unlink
42
+ end
43
+
44
+ sio = StringIO.new(sample_packed)
45
+ u2 = MessagePack::Unpacker.new(sio)
46
+ u2.each do |obj|
47
+ expect(obj).to eql(sample_data)
48
+ end
49
+
50
+ dio = StringIO.new
51
+ Zlib::GzipWriter.wrap(dio){|gz| gz.write sample_packed }
52
+ reader = Zlib::GzipReader.new(StringIO.new(dio.string))
53
+ u3 = MessagePack::Unpacker.new(reader)
54
+ u3.each do |obj|
55
+ expect(obj).to eql(sample_data)
56
+ end
57
+
58
+ class DummyIO
59
+ def initialize
60
+ @buf = "".force_encoding('ASCII-8BIT')
61
+ @pos = 0
62
+ end
63
+ def write(val)
64
+ @buf << val.to_s
65
+ end
66
+ def read(length=nil,outbuf="")
67
+ if @pos == @buf.size
68
+ nil
69
+ elsif length.nil?
70
+ val = @buf[@pos..(@buf.size)]
71
+ @pos = @buf.size
72
+ outbuf << val
73
+ outbuf
74
+ else
75
+ val = @buf[@pos..(@pos + length)]
76
+ @pos += val.size
77
+ @pos = @buf.size if @pos > @buf.size
78
+ outbuf << val
79
+ outbuf
80
+ end
81
+ end
82
+ def flush
83
+ # nop
84
+ end
85
+ end
86
+
87
+ dio = DummyIO.new
88
+ dio.write sample_packed
89
+ u4 = MessagePack::Unpacker.new(dio)
90
+ u4.each do |obj|
91
+ expect(obj).to eql(sample_data)
92
+ end
93
+ end
94
+
27
95
  it 'read_array_header succeeds' do
28
96
  unpacker.feed("\x91")
29
97
  unpacker.read_array_header.should == 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2dev1
5
5
  platform: java
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-11-20 00:00:00.000000000 Z
13
+ date: 2015-12-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
21
  name: bundler
@@ -23,13 +23,13 @@ dependencies:
23
23
  type: :development
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '1.0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.9.2
35
35
  name: rake
@@ -37,13 +37,13 @@ dependencies:
37
37
  type: :development
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: 0.9.2
43
43
  - !ruby/object:Gem::Dependency
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 0.9.4
49
49
  name: rake-compiler
@@ -51,13 +51,13 @@ dependencies:
51
51
  type: :development
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: 0.9.4
57
57
  - !ruby/object:Gem::Dependency
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '3.3'
63
63
  name: rspec
@@ -65,13 +65,13 @@ dependencies:
65
65
  type: :development
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '3.3'
71
71
  - !ruby/object:Gem::Dependency
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: 0.8.2
77
77
  name: yard
@@ -79,13 +79,13 @@ dependencies:
79
79
  type: :development
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ~>
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 0.8.2
85
85
  - !ruby/object:Gem::Dependency
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  name: json
@@ -93,7 +93,7 @@ dependencies:
93
93
  type: :development
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  description: MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.
@@ -144,14 +144,14 @@ require_paths:
144
144
  - lib
145
145
  required_ruby_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - '>='
147
+ - - ">="
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - '>='
152
+ - - ">"
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: 1.3.1
155
155
  requirements: []
156
156
  rubyforge_project: msgpack
157
157
  rubygems_version: 2.4.8