Class List Method List File List

# Class: Vertx::HttpServerFileUpload

Inherits:
  Object
  - Object
  - Vertx::HttpServerFileUpload
  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)

- + (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) content_transfer_encoding
  The contentTransferEncoding for the upload.
- - (String) content_type
  The content type for the upload.
- - (self) end_handler { ... }
- - (self) exception_handler { ... }
- - (self) fetch(amount = nil)
- - (::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 { ... }
- - (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) pipe_to(dst = nil) { ... }
  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) size_available?
  true if the size of the upload can be retrieved via #size.
- - (self) stream_to_file_system(filename = nil)
  Stream the content of this upload to the given file on storage.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

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

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

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

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

### + (`Object`) unwrap(obj)

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

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

### + (`Object`) wrap(obj)

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

    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`)

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

    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`)

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

    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`)

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

    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`)

    85
    86
    87
    88
    89
    90
    91
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_server_file_upload.rb', line 85

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

### - (`self`) exception_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    def exception_handler
      if block_given?
        @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
        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`)

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

    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:

- (`::Vertx::AsyncFile`) —
  the async uploaded file when #stream_to_file_system has been used

Raises:

- (`ArgumentError`)

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

    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`)

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

    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`)

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

    def handler
      if block_given?
        @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Buffer)) }))
        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`)

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

    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`)

    93
    94
    95
    96
    97
    98
    99
    # 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
      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:

- (`::Vertx::Pipe`) —
  a pipe

Raises:

- (`ArgumentError`)

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

    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:

- dst (`::Vertx::WriteStream`) (defaults to: `nil`) —
  the destination write stream

Yields:

Raises:

- (`ArgumentError`)

    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 57

    def pipe_to(dst=nil)
      if dst.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class]).call(dst.j_del)
      elsif dst.class.method_defined?(:j_del) && block_given?
        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) }))
      end
      raise ArgumentError, "Invalid arguments when calling pipe_to(#{dst})"
    end

### - (`self`) resume

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    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`)

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

    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`)

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

    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`)

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

    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