Class: VertxWebCommon::BodyCodec
- Inherits:
-
Object
- Object
- VertxWebCommon::BodyCodec
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb
Overview
A codec for encoding and decoding HTTP bodies.
Class Method Summary (collapse)
-
+ (::VertxWebCommon::BodyCodec) buffer
The codec.
-
+ (::VertxWebCommon::BodyCodec) create(decode = nil) { ... }
Create a codec that buffers the entire body and then apply the decode function and returns the result.
-
+ (::VertxWebCommon::BodyCodec) json(type = nil)
Create and return a codec for Java objects encoded using Jackson mapper.
-
+ (::VertxWebCommon::BodyCodec) json_array
The codec.
-
+ (::VertxWebCommon::BodyCodec) json_object
The codec.
-
+ (::VertxWebCommon::BodyCodec) json_stream(parser = nil)
A body codec that parse the response as a JSON stream.
-
+ (::VertxWebCommon::BodyCodec) none
A codec that simply discards the response.
-
+ (::VertxWebCommon::BodyCodec) pipe(stream = nil, close = nil)
A body codec that pipes the body to a write stream.
-
+ (::VertxWebCommon::BodyCodec) string(encoding = nil)
A codec for strings using a specific encoding.
Class Method Details
+ (::VertxWebCommon::BodyCodec) buffer
Returns the codec
32 33 34 35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 32 def self.buffer if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:buffer, []).call(),::VertxWebCommon::BodyCodec,::Vertx::Buffer.j_api_type) end raise ArgumentError, "Invalid arguments when calling buffer()" end |
+ (::VertxWebCommon::BodyCodec) create(decode = nil) { ... }
Create a codec that buffers the entire body and then apply the
decode function and returns the result.
71 72 73 74 75 76 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 71 def self.create(decode=nil) if block_given? && decode == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:create, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Buffer))) unless !block_given? })),::VertxWebCommon::BodyCodec, nil) end raise ArgumentError, "Invalid arguments when calling create(#{decode})" end |
+ (::VertxWebCommon::BodyCodec) json(type = nil)
Create and return a codec for Java objects encoded using Jackson mapper.
55 56 57 58 59 60 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 55 def self.json(type=nil) if type.class == Class && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:json, [Java::JavaLang::Class.java_class]).call(::Vertx::Util::Utils.j_class_of(type)),::VertxWebCommon::BodyCodec, ::Vertx::Util::Utils.v_type_of(type)) end raise ArgumentError, "Invalid arguments when calling json(#{type})" end |
+ (::VertxWebCommon::BodyCodec) json_array
Returns the codec
46 47 48 49 50 51 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 46 def self.json_array if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:jsonArray, []).call(),::VertxWebCommon::BodyCodec, nil) end raise ArgumentError, "Invalid arguments when calling json_array()" end |
+ (::VertxWebCommon::BodyCodec) json_object
Returns the codec
39 40 41 42 43 44 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 39 def self.json_object if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:jsonObject, []).call(),::VertxWebCommon::BodyCodec, nil) end raise ArgumentError, "Invalid arguments when calling json_object()" end |
+ (::VertxWebCommon::BodyCodec) json_stream(parser = nil)
A body codec that parse the response as a JSON stream.
92 93 94 95 96 97 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 92 def self.json_stream(parser=nil) if parser.class.method_defined?(:j_del) && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:jsonStream, [Java::IoVertxCoreParsetools::JsonParser.java_class]).call(parser.j_del),::VertxWebCommon::BodyCodec, nil) end raise ArgumentError, "Invalid arguments when calling json_stream(#{parser})" end |
+ (::VertxWebCommon::BodyCodec) none
Returns a codec that simply discards the response
62 63 64 65 66 67 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 62 def self.none if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:none, []).call(),::VertxWebCommon::BodyCodec, nil) end raise ArgumentError, "Invalid arguments when calling none()" end |
+ (::VertxWebCommon::BodyCodec) pipe(stream = nil, close = nil)
A body codec that pipes the body to a write stream.
81 82 83 84 85 86 87 88 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 81 def self.pipe(stream=nil,close=nil) if stream.class.method_defined?(:j_del) && !block_given? && close == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:pipe, [Java::IoVertxCoreStreams::WriteStream.java_class]).call(stream.j_del),::VertxWebCommon::BodyCodec, nil) elsif stream.class.method_defined?(:j_del) && (close.class == TrueClass || close.class == FalseClass) && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:pipe, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::boolean.java_class]).call(stream.j_del,close),::VertxWebCommon::BodyCodec, nil) end raise ArgumentError, "Invalid arguments when calling pipe(#{stream},#{close})" end |
+ (::VertxWebCommon::BodyCodec) string(encoding = nil)
A codec for strings using a specific
encoding.
23 24 25 26 27 28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 23 def self.string(encoding=nil) if !block_given? && encoding == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:string, []).call(),::VertxWebCommon::BodyCodec, nil) elsif encoding.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:string, [Java::java.lang.String.java_class]).call(encoding),::VertxWebCommon::BodyCodec, nil) end raise ArgumentError, "Invalid arguments when calling string(#{encoding})" end |