Class HttpServerFileUpload

java.lang.Object
io.vertx.mutiny.core.http.HttpServerFileUpload
All Implemented Interfaces:
MutinyDelegate, ReadStream<io.vertx.core.buffer.Buffer>, StreamBase

public class HttpServerFileUpload extends Object implements ReadStream<io.vertx.core.buffer.Buffer>, MutinyDelegate
Represents an file upload from an HTML FORM.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Norman Maurer
See Also:
  • HttpServerFileUpload
  • Field Details

  • Constructor Details

    • HttpServerFileUpload

      public HttpServerFileUpload(io.vertx.core.http.HttpServerFileUpload delegate)
      Create a new instance of HttpServerFileUpload delegating to the given (non-null) instance of HttpServerFileUpload.
    • HttpServerFileUpload

      public HttpServerFileUpload(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.core.http.HttpServerFileUpload getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Specified by:
      getDelegate in interface ReadStream<io.vertx.core.buffer.Buffer>
      Specified by:
      getDelegate in interface StreamBase
      Returns:
      the delegate instance
    • streamToFileSystem

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> streamToFileSystem(String filename)
      Stream the content of this upload to the given file on storage.

      If the stream has a failure or is cancelled the created file will be deleted.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      filename - the name of the file
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • HttpServerFileUpload.streamToFileSystem(String)
    • streamToFileSystemAndAwait

      public void streamToFileSystemAndAwait(String filename)
      Stream the content of this upload to the given file on storage.

      If the stream has a failure or is cancelled the created file will be deleted.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      filename - the name of the file
      See Also:
      • HttpServerFileUpload.streamToFileSystem(String)
    • streamToFileSystemAndForget

      public HttpServerFileUpload streamToFileSystemAndForget(String filename)
      Stream the content of this upload to the given file on storage.

      If the stream has a failure or is cancelled the created file will be deleted.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      filename - the name of the file
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • HttpServerFileUpload.streamToFileSystem(String)
    • pipeTo

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<io.vertx.core.buffer.Buffer> arg0)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Specified by:
      pipeTo in interface ReadStream<io.vertx.core.buffer.Buffer>
      Parameters:
      dst - the destination write stream
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.core.http.HttpServerFileUpload#pipeTo(WriteStream)
    • pipeToAndAwait

      public void pipeToAndAwait(WriteStream<io.vertx.core.buffer.Buffer> arg0)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      dst - the destination write stream
      See Also:
      • io.vertx.core.http.HttpServerFileUpload#pipeTo(WriteStream)
    • pipeToAndForget

      public HttpServerFileUpload pipeToAndForget(WriteStream<io.vertx.core.buffer.Buffer> arg0)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      dst - the destination write stream
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • io.vertx.core.http.HttpServerFileUpload#pipeTo(WriteStream)
    • exceptionHandler

      public HttpServerFileUpload exceptionHandler(Consumer<Throwable> handler)
      Description copied from interface: ReadStream
      Set an exception handler on the read stream.
      Specified by:
      exceptionHandler in interface ReadStream<io.vertx.core.buffer.Buffer>
      Specified by:
      exceptionHandler in interface StreamBase
      Parameters:
      handler - the exception handler. Can be null.
      Returns:
      a reference to this, so the API can be used fluently
    • handler

      public HttpServerFileUpload handler(Consumer<io.vertx.core.buffer.Buffer> handler)
      Description copied from interface: ReadStream
      Set a data handler. As data is read, the handler will be called with the data.
      Specified by:
      handler in interface ReadStream<io.vertx.core.buffer.Buffer>
      Returns:
      a reference to this, so the API can be used fluently
    • endHandler

      public HttpServerFileUpload endHandler(Runnable endHandler)
      Description copied from interface: ReadStream
      Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
      Specified by:
      endHandler in interface ReadStream<io.vertx.core.buffer.Buffer>
      Returns:
      a reference to this, so the API can be used fluently
    • pause

      public HttpServerFileUpload pause()
      Description copied from interface: ReadStream
      Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

      While it's paused, no data will be sent to the data handler.

      Specified by:
      pause in interface ReadStream<io.vertx.core.buffer.Buffer>
      Returns:
      a reference to this, so the API can be used fluently
    • resume

      public HttpServerFileUpload resume()
      Description copied from interface: ReadStream
      Resume reading, and sets the buffer in flowing mode.

      If the ReadStream has been paused, reading will recommence on it.

      Specified by:
      resume in interface ReadStream<io.vertx.core.buffer.Buffer>
      Returns:
      a reference to this, so the API can be used fluently
    • fetch

      public HttpServerFileUpload fetch(long amount)
      Description copied from interface: ReadStream
      Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.
      Specified by:
      fetch in interface ReadStream<io.vertx.core.buffer.Buffer>
      Returns:
      a reference to this, so the API can be used fluently
    • cancelStreamToFileSystem

      public boolean cancelStreamToFileSystem() throws IllegalStateException
      Try to cancel the file system streaming, the streamed file will be deleted.
      Returns:
      true when the stream is cancelled, otherwise it means that stream is finished
      Throws:
      when - no stream is in progress
      IllegalStateException
    • filename

      public String filename()
      Returns:
      the filename which was used when upload the file.
    • name

      public String name()
      Returns:
      the name of the attribute
    • contentType

      public String contentType()
      Returns:
      the content type for the upload
    • contentTransferEncoding

      public String contentTransferEncoding()
      Returns:
      the contentTransferEncoding for the upload
    • charset

      public String charset()
      Returns:
      the charset for the upload
    • size

      public long size()
      The size of the upload may not be available until it is all read. Check isSizeAvailable() to determine this
      Returns:
      the size of the upload (in bytes)
    • isSizeAvailable

      public boolean isSizeAvailable()
      Returns:
      true if the size of the upload can be retrieved via size().
    • file

      public AsyncFile file()
      Returns:
      the async uploaded file when streamToFileSystem(java.lang.String) has been used and the file is available
    • pipe

      public Pipe<io.vertx.core.buffer.Buffer> pipe()
      Pause this stream and return a Pipe to transfer the elements of this stream to a destination WriteStream.

      The stream will be resumed when the pipe will be wired to a WriteStream.

      Specified by:
      pipe in interface ReadStream<io.vertx.core.buffer.Buffer>
      Returns:
      a pipe
    • newInstance

      public static HttpServerFileUpload newInstance(io.vertx.core.http.HttpServerFileUpload delegate)
      Creates a new instance of the HttpServerFileUpload.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toMulti

      @CheckReturnValue public io.smallrye.mutiny.Multi<io.vertx.core.buffer.Buffer> toMulti()
    • toBlockingIterable

      public Iterable<io.vertx.core.buffer.Buffer> toBlockingIterable()
    • toBlockingStream

      public Stream<io.vertx.core.buffer.Buffer> toBlockingStream()