Top Description Methods
io.vertx.core.http

public Interface HttpServerFileUpload

extends ReadStream<Buffer>
Known Direct Implementers
io.vertx.core.http.impl.HttpServerFileUploadImpl
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.Fluent, .VertxGen, io.vertx.core.AsyncResult, .Future, .Handler, io.vertx.core.buffer.Buffer, io.vertx.core.file.AsyncFile, io.vertx.core.streams.ReadStream

Represents an file upload from an HTML FORM.
Author
Norman Maurer

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true when the stream is cancelled, otherwise it means that stream is finished
cancelStreamToFileSystem
()

Try to cancel the file system streaming, the streamed file will be deleted.

public String

Returns:

the charset for the upload
charset
()

public String

Returns:

the contentTransferEncoding for the upload
contentTransferEncoding
()

public String

Returns:

the content type for the upload
contentType
()

public HttpServerFileUpload
endHandler(Handler<Void> endHandler)

public HttpServerFileUpload
public HttpServerFileUpload
fetch(long amount)

Redeclares io.vertx.core.streams.ReadStream.fetch.

Fetch the specified amount of elements.

public AsyncFile

Returns:

the async uploaded file when streamToFileSystem has been used and the file is available
file
()

public String

Returns:

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

public HttpServerFileUpload
public boolean

Returns:

true if the size of the upload can be retrieved via size().
isSizeAvailable
()

public String

Returns:

the name of the attribute
name
()

public HttpServerFileUpload
pause()

Redeclares io.vertx.core.streams.ReadStream.pause.

Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

public HttpServerFileUpload
resume()

Redeclares io.vertx.core.streams.ReadStream.resume.

Resume reading, and sets the buffer in flowing mode.

public long

Returns:

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

The size of the upload may not be available until it is all read.

public void
streamToFileSystem(String
the name of the file
filename
,
Handler<AsyncResult<Void>> handler)

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

public Future<Void>
streamToFileSystem(String
the name of the file
filename
)

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

Inherited from io.vertx.core.streams.ReadStream:
collectendHandlerexceptionHandlerhandlerpipepipeTopipeTo

Method Detail

cancelStreamToFileSystemback to summary
public boolean cancelStreamToFileSystem() throws IllegalStateException

Try to cancel the file system streaming, the streamed file will be deleted.

Returns:boolean

true when the stream is cancelled, otherwise it means that stream is finished

Exceptions
IllegalStateException:
when no stream is in progress
charsetback to summary
public String charset()
Returns:String

the charset for the upload

contentTransferEncodingback to summary
public String contentTransferEncoding()
Returns:String

the contentTransferEncoding for the upload

contentTypeback to summary
public String contentType()
Returns:String

the content type for the upload

endHandlerback to summary
public HttpServerFileUpload endHandler(Handler<Void> endHandler)
Annotations
@Override
exceptionHandlerback to summary
public HttpServerFileUpload exceptionHandler(Handler<Throwable> handler)
Annotations
@Override
fetchback to summary
public HttpServerFileUpload fetch(long amount)

Redeclares io.vertx.core.streams.ReadStream.fetch.

Doc from io.vertx.core.streams.ReadStream.fetch.

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.

Returns:HttpServerFileUpload

a reference to this, so the API can be used fluently

Annotations
@Override
fileback to summary
public AsyncFile file()
Returns:AsyncFile

the async uploaded file when streamToFileSystem has been used and the file is available

filenameback to summary
public String filename()
Returns:String

the filename which was used when upload the file.

handlerback to summary
public HttpServerFileUpload handler(Handler<Buffer> handler)
Annotations
@Override
isSizeAvailableback to summary
public boolean isSizeAvailable()
Returns:boolean

true if the size of the upload can be retrieved via size().

nameback to summary
public String name()
Returns:String

the name of the attribute

pauseback to summary
public HttpServerFileUpload pause()

Redeclares io.vertx.core.streams.ReadStream.pause.

Doc from io.vertx.core.streams.ReadStream.pause.

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.

Returns:HttpServerFileUpload

a reference to this, so the API can be used fluently

Annotations
@Override
resumeback to summary
public HttpServerFileUpload resume()

Redeclares io.vertx.core.streams.ReadStream.resume.

Doc from io.vertx.core.streams.ReadStream.resume.

Resume reading, and sets the buffer in flowing mode.

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

Returns:HttpServerFileUpload

a reference to this, so the API can be used fluently

Annotations
@Override
sizeback to summary
public long size()

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

Returns:long

the size of the upload (in bytes)

streamToFileSystemback to summary
public void streamToFileSystem(String filename, Handler<AsyncResult<Void>> handler)

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

Parameters
filename:String

the name of the file

streamToFileSystemback to summary
public Future<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.

Parameters
filename:String

the name of the file