Class: Vertx::HttpServerFileUpload
- Inherits:
-
Object
- Object
- Vertx::HttpServerFileUpload
- Includes:
- ReadStream
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb
Overview
Represents an file upload from an HTML FORM.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (String) charset
The charset for the upload.
-
- (String) contentTransferEncoding
The contentTransferEncoding for the upload.
-
- (String) contentType
The content type for the upload.
- - (self) endHandler(endHandler) { ... }
- - (self) exceptionHandler(handler) { ... }
- - (self) fetch(amount)
-
- (::Vertx::AsyncFile) file
The async uploaded file when #stream_to_file_system has been used.
-
- (String) filename
The filename which was used when upload the file.
- - (self) handler(handler) { ... }
-
- (String) name
The name of the attribute.
- - (self) pause
-
- (::Vertx::Pipe) pipe
Pause this stream and return a to transfer the elements of this stream to a destination .
-
- (void) pipeTo(dst, handler) { ... }
Pipe this ReadStream to the WriteStream.
- - (self) resume
-
- (Fixnum) size
The size of the upload may not be available until it is all read.
-
- (true, false) isSizeAvailable
true if the size of the upload can be retrieved via #size.
-
- (self) streamToFileSystem(filename)
Stream the content of this upload to the given file on storage.
Class Method Details
+ (Boolean) accept?(obj)
25 26 27 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 25 def @@j_api_type.accept?(obj) obj.class == HttpServerFileUpload end |
+ (Object) j_api_type
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 34 def self.j_api_type @@j_api_type end |
+ (Object) j_class
37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 37 def self.j_class Java::IoVertxCoreHttp::HttpServerFileUpload.java_class end |
+ (Object) unwrap(obj)
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 31 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 28 def @@j_api_type.wrap(obj) HttpServerFileUpload.new(obj) end |
Instance Method Details
- (String) charset
Returns the charset for the upload
55 56 57 58 59 60 61 62 63 64 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 55 def charset if !block_given? return @j_del.java_method(:charset, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling charset()" end end |
- (String) contentTransferEncoding
Returns the contentTransferEncoding for the upload
81 82 83 84 85 86 87 88 89 90 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 81 def content_transfer_encoding if !block_given? return @j_del.java_method(:contentTransferEncoding, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling content_transfer_encoding()" end end |
- (String) contentType
Returns the content type for the upload
252 253 254 255 256 257 258 259 260 261 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 252 def content_type if !block_given? return @j_del.java_method(:contentType, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling content_type()" end end |
- (self) endHandler(endHandler) { ... }
186 187 188 189 190 191 192 193 194 195 196 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 186 def end_handler if true @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(nil) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling end_handler()" end end |
- (self) exceptionHandler(handler) { ... }
265 266 267 268 269 270 271 272 273 274 275 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 265 def exception_handler if true @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling exception_handler()" end end |
- (self) fetch(amount)
200 201 202 203 204 205 206 207 208 209 210 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 200 def fetch(*args) if args[0].class == Fixnum && !block_given? @j_del.java_method(:fetch, [Java::long.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling fetch(#{args[0]})" end end |
- (::Vertx::AsyncFile) file
Returns the async uploaded file when #stream_to_file_system has been used
121 122 123 124 125 126 127 128 129 130 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 121 def file if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:file, []).call(),::Vertx::AsyncFile) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling file()" end end |
- (String) filename
Returns the filename which was used when upload the file.
133 134 135 136 137 138 139 140 141 142 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 133 def filename if !block_given? return @j_del.java_method(:filename, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling filename()" end end |
- (self) handler(handler) { ... }
68 69 70 71 72 73 74 75 76 77 78 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 68 def handler if true @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Buffer)) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling handler()" end end |
- (String) name
Returns the name of the attribute
213 214 215 216 217 218 219 220 221 222 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 213 def name if !block_given? return @j_del.java_method(:name, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling name()" end end |
- (self) pause
93 94 95 96 97 98 99 100 101 102 103 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 93 def pause if !block_given? @j_del.java_method(:pause, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling pause()" end end |
- (::Vertx::Pipe) pipe
Pause this stream and return a to transfer the elements of this stream to a destination .
The stream will be resumed when the pipe will be wired to a
WriteStream
.
228 229 230 231 232 233 234 235 236 237 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 228 def pipe if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:pipe, []).call(),::Vertx::Pipe,::Vertx::Buffer.j_api_type) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling pipe()" end end |
- (void) pipeTo(dst, handler) { ... }
This method returns an undefined value.
Pipe thisReadStream
to the WriteStream
.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler
will be
called with the result.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 153 def pipe_to(*args) if args[0].class.method_defined?(:j_del) && true if (block_given?) return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling pipe_to(#{args[0]})" end end |
- (self) resume
42 43 44 45 46 47 48 49 50 51 52 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 42 def resume if !block_given? @j_del.java_method(:resume, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling resume()" end end |
- (Fixnum) size
The size of the upload may not be available until it is all read.
Check #is_size_available to determine this
173 174 175 176 177 178 179 180 181 182 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 173 def size if !block_given? return @j_del.java_method(:size, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling size()" end end |
- (true, false) isSizeAvailable
Returns
true
if the size of the upload can be retrieved via #size.
240 241 242 243 244 245 246 247 248 249 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 240 def size_available? if !block_given? return @j_del.java_method(:isSizeAvailable, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling size_available?()" end end |
- (self) streamToFileSystem(filename)
Stream the content of this upload to the given file on storage.
108 109 110 111 112 113 114 115 116 117 118 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 108 def stream_to_file_system(*args) if args[0].class == String && !block_given? @j_del.java_method(:streamToFileSystem, [Java::java.lang.String.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling stream_to_file_system(#{args[0]})" end end |