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) { ... }
Create a codec that buffers the entire body and then apply the decode function and returns the result.
-
+ (::VertxWebCommon::BodyCodec) json(type)
Create and return a codec for Java objects encoded using Jackson mapper.
-
+ (::VertxWebCommon::BodyCodec) jsonArray
The codec.
-
+ (::VertxWebCommon::BodyCodec) jsonObject
The codec.
-
+ (::VertxWebCommon::BodyCodec) jsonStream(parser)
A body codec that parse the response as a JSON stream.
-
+ (::VertxWebCommon::BodyCodec) none
A codec that simply discards the response.
-
+ (::VertxWebCommon::BodyCodec) pipe(*args)
A body codec that pipes the body to a write stream.
-
+ (::VertxWebCommon::BodyCodec) string(*args)
A codec for strings using a specific encoding.
Class Method Details
+ (::VertxWebCommon::BodyCodec) buffer
Returns the codec
125 126 127 128 129 130 131 132 133 134 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 125 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 if defined?(super) super else raise ArgumentError, "Invalid arguments when calling buffer()" end end |
+ (::VertxWebCommon::BodyCodec) create(decode) { ... }
Create a codec that buffers the entire body and then apply the
decode
function and returns the result.
56 57 58 59 60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 56 def self.create(*args) if block_given? && args[0] == 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 if defined?(super) super else raise ArgumentError, "Invalid arguments when calling create(#{args[0]})" end end |
+ (::VertxWebCommon::BodyCodec) json(type)
Create and return a codec for Java objects encoded using Jackson mapper.
70 71 72 73 74 75 76 77 78 79 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 70 def self.json(*args) if args[0].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(args[0])),::VertxWebCommon::BodyCodec, ::Vertx::Util::Utils.v_type_of(args[0])) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling json(#{args[0]})" end end |
+ (::VertxWebCommon::BodyCodec) jsonArray
Returns the codec
137 138 139 140 141 142 143 144 145 146 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 137 def self.json_array if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:jsonArray, []).call(),::VertxWebCommon::BodyCodec, nil) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling json_array()" end end |
+ (::VertxWebCommon::BodyCodec) jsonObject
Returns the codec
113 114 115 116 117 118 119 120 121 122 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 113 def self.json_object if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:jsonObject, []).call(),::VertxWebCommon::BodyCodec, nil) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling json_object()" end end |
+ (::VertxWebCommon::BodyCodec) jsonStream(parser)
A body codec that parse the response as a JSON stream.
42 43 44 45 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 42 def self.json_stream(*args) if args[0].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(args[0].j_del),::VertxWebCommon::BodyCodec, nil) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling json_stream(#{args[0]})" end end |
+ (::VertxWebCommon::BodyCodec) none
Returns a codec that simply discards the response
101 102 103 104 105 106 107 108 109 110 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 101 def self.none if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:none, []).call(),::VertxWebCommon::BodyCodec, nil) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling none()" end end |
+ (::VertxWebCommon::BodyCodec) pipe(stream) + (::VertxWebCommon::BodyCodec) pipe(stream, close)
A body codec that pipes the body to a write stream.
87 88 89 90 91 92 93 94 95 96 97 98 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/body_codec.rb', line 87 def self.pipe(*args) if args[0].class.method_defined?(:j_del) && !block_given? && args[1] == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:pipe, [Java::IoVertxCoreStreams::WriteStream.java_class]).call(args[0].j_del),::VertxWebCommon::BodyCodec, nil) elsif args[0].class.method_defined?(:j_del) && (args[1].class == TrueClass || args[1].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(args[0].j_del,args[1]),::VertxWebCommon::BodyCodec, nil) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling pipe(#{args[0]},#{args[1]})" end end |
+ (::VertxWebCommon::BodyCodec) string + (::VertxWebCommon::BodyCodec) string(encoding)
A codec for strings using a specific
encoding
.
26 27 28 29 30 31 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 26 def self.string(*args) if !block_given? && args[0] == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:string, []).call(),::VertxWebCommon::BodyCodec, nil) elsif args[0].class == String && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebCodec::BodyCodec.java_method(:string, [Java::java.lang.String.java_class]).call(args[0]),::VertxWebCommon::BodyCodec, nil) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling string(#{args[0]})" end end |