Class: Vertx::HttpServerFileUpload

Inherits:
Object
  • Object
show all
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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 24

def @@j_api_type.accept?(obj)
  obj.class == HttpServerFileUpload
end

+ (Object) j_api_type



33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 33

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



36
37
38
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 36

def self.j_class
  Java::IoVertxCoreHttp::HttpServerFileUpload.java_class
end

+ (Object) unwrap(obj)



30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 30

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 27

def @@j_api_type.wrap(obj)
  HttpServerFileUpload.new(obj)
end

Instance Method Details

- (String) charset

Returns the charset for the upload

Returns:

  • (String)
    the charset for the upload

Raises:

  • (ArgumentError)


155
156
157
158
159
160
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 155

def charset
  if !block_given?
    return @j_del.java_method(:charset, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling charset()"
end

- (String) content_transfer_encoding

Returns the contentTransferEncoding for the upload

Returns:

  • (String)
    the contentTransferEncoding for the upload

Raises:

  • (ArgumentError)


148
149
150
151
152
153
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 148

def content_transfer_encoding
  if !block_given?
    return @j_del.java_method(:contentTransferEncoding, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling content_transfer_encoding()"
end

- (String) content_type

Returns the content type for the upload

Returns:

  • (String)
    the content type for the upload

Raises:

  • (ArgumentError)


141
142
143
144
145
146
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 141

def content_type
  if !block_given?
    return @j_del.java_method(:contentType, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling content_type()"
end

- (self) end_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


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 84

def end_handler
  if true
    @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield unless !block_given? })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling end_handler()"
end

- (self) exception_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


66
67
68
69
70
71
72
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 66

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
  raise ArgumentError, "Invalid arguments when calling exception_handler()"
end

- (self) fetch(amount = nil)

Parameters:

  • amount (Fixnum) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


109
110
111
112
113
114
115
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 109

def fetch(amount=nil)
  if amount.class == Fixnum && !block_given?
    @j_del.java_method(:fetch, [Java::long.java_class]).call(amount)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling fetch(#{amount})"
end

- (::Vertx::AsyncFile) file

Returns the async uploaded file when #stream_to_file_system has been used

Returns:

Raises:

  • (ArgumentError)


178
179
180
181
182
183
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 178

def file
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:file, []).call(),::Vertx::AsyncFile)
  end
  raise ArgumentError, "Invalid arguments when calling file()"
end

- (String) filename

Returns the filename which was used when upload the file.

Returns:

  • (String)
    the filename which was used when upload the file.

Raises:

  • (ArgumentError)


127
128
129
130
131
132
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 127

def filename
  if !block_given?
    return @j_del.java_method(:filename, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling filename()"
end

- (self) handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


75
76
77
78
79
80
81
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 75

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
  raise ArgumentError, "Invalid arguments when calling handler()"
end

- (String) name

Returns the name of the attribute

Returns:

  • (String)
    the name of the attribute

Raises:

  • (ArgumentError)


134
135
136
137
138
139
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 134

def name
  if !block_given?
    return @j_del.java_method(:name, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling name()"
end

- (self) pause

Returns:

  • (self)

Raises:

  • (ArgumentError)


92
93
94
95
96
97
98
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 92

def pause
  if !block_given?
    @j_del.java_method(:pause, []).call()
    return self
  end
  raise ArgumentError, "Invalid arguments when calling pause()"
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.

Returns:

Raises:

  • (ArgumentError)


43
44
45
46
47
48
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 43

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
  raise ArgumentError, "Invalid arguments when calling pipe()"
end

- (void) pipe_to(dst = nil) { ... }

This method returns an undefined value.

Pipe this ReadStream 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.

Parameters:

Yields:

Raises:

  • (ArgumentError)


58
59
60
61
62
63
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 58

def pipe_to(dst=nil)
  if dst.class.method_defined?(:j_del) && true
    return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(dst.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?))
  end
  raise ArgumentError, "Invalid arguments when calling pipe_to(#{dst})"
end

- (self) resume

Returns:

  • (self)

Raises:

  • (ArgumentError)


100
101
102
103
104
105
106
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 100

def resume
  if !block_given?
    @j_del.java_method(:resume, []).call()
    return self
  end
  raise ArgumentError, "Invalid arguments when calling resume()"
end

- (Fixnum) size

The size of the upload may not be available until it is all read. Check #is_size_available to determine this

Returns:

  • (Fixnum)
    the size of the upload (in bytes)

Raises:

  • (ArgumentError)


164
165
166
167
168
169
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 164

def size
  if !block_given?
    return @j_del.java_method(:size, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling size()"
end

- (true, false) size_available?

Returns true if the size of the upload can be retrieved via #size.

Returns:

  • (true, false)
    true if the size of the upload can be retrieved via #size.

Raises:

  • (ArgumentError)


171
172
173
174
175
176
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 171

def size_available?
  if !block_given?
    return @j_del.java_method(:isSizeAvailable, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling size_available?()"
end

- (self) stream_to_file_system(filename = nil)

Stream the content of this upload to the given file on storage.

Parameters:

  • filename (String) (defaults to: nil)
    the name of the file

Returns:

  • (self)

Raises:

  • (ArgumentError)


119
120
121
122
123
124
125
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 119

def stream_to_file_system(filename=nil)
  if filename.class == String && !block_given?
    @j_del.java_method(:streamToFileSystem, [Java::java.lang.String.java_class]).call(filename)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling stream_to_file_system(#{filename})"
end