Interface StreamVariable
- All Superinterfaces:
Serializable
OutputStream
provided by the getOutputStream()
method. E.g.
in web terminals StreamVariable
can be used to send large files from
browsers to the server without consuming large amounts of memory.
Note, writing to the OutputStream
is not synchronized by the handler
(to avoid stalls in other operations when e.g. streaming to a slow network
service or file system). If UI is changed as a side effect of writing to the
output stream, developer must handle synchronization manually.
- Since:
- 1.0.
- Author:
- Vaadin Ltd
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Deprecated, for removal: This API element is subject to removal in a future version.Event passed tostreamingFinished(StreamingEndEvent)
method the contents have been streamed to StreamVariable successfully.static interface
Deprecated, for removal: This API element is subject to removal in a future version.Event passed tostreamingFailed(StreamingErrorEvent)
method when the streaming ended before the end of the input.static interface
Deprecated, for removal: This API element is subject to removal in a future version.Streaming event interface.static interface
Deprecated, for removal: This API element is subject to removal in a future version.Event passed toonProgress(StreamingProgressEvent)
method during the streaming progresses.static interface
Deprecated, for removal: This API element is subject to removal in a future version.Event passed tostreamingStarted(StreamingStartEvent)
method before the streaming of the content toStreamVariable
starts. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Invoked when a new upload arrives, afterstreamingStarted(StreamingStartEvent)
method has been called.boolean
Deprecated, for removal: This API element is subject to removal in a future version.If this method returns true while the content is being streamed the handler is told to stop receiving the current upload.boolean
Deprecated, for removal: This API element is subject to removal in a future version.Whether theonProgress(StreamingProgressEvent)
method should be called during the upload.void
Deprecated, for removal: This API element is subject to removal in a future version.This method is called iflistenProgress()
returns true when the streaming starts.void
Deprecated, for removal: This API element is subject to removal in a future version.This method is called when the streaming has failed.void
Deprecated, for removal: This API element is subject to removal in a future version.This method is called when the streaming has finished.void
Deprecated, for removal: This API element is subject to removal in a future version.This method is called when the streaming starts.
-
Method Details
-
getOutputStream
OutputStream getOutputStream()Deprecated, for removal: This API element is subject to removal in a future version.Invoked when a new upload arrives, afterstreamingStarted(StreamingStartEvent)
method has been called. The implementation will write the streamed variable to the returned output stream.- Returns:
- Stream to which the uploaded file should be written.
-
listenProgress
boolean listenProgress()Deprecated, for removal: This API element is subject to removal in a future version.Whether theonProgress(StreamingProgressEvent)
method should be called during the upload.onProgress(StreamingProgressEvent)
is called in a synchronized block when the content is being received. This is potentially bit slow, so we are calling that method only if requested. The value is requested after thestreamingStarted(StreamingStartEvent)
event, but not after reading each buffer.- Returns:
- true if this
StreamVariable
wants to by notified during the upload of the progress of streaming. - See Also:
-
onProgress
Deprecated, for removal: This API element is subject to removal in a future version.This method is called iflistenProgress()
returns true when the streaming starts.- Parameters:
event
- streaming progress event
-
streamingStarted
Deprecated, for removal: This API element is subject to removal in a future version.This method is called when the streaming starts.- Parameters:
event
- streaming start event
-
streamingFinished
Deprecated, for removal: This API element is subject to removal in a future version.This method is called when the streaming has finished.- Parameters:
event
- streaming end event
-
streamingFailed
Deprecated, for removal: This API element is subject to removal in a future version.This method is called when the streaming has failed.- Parameters:
event
- streaming error event
-
isInterrupted
boolean isInterrupted()Deprecated, for removal: This API element is subject to removal in a future version.If this method returns true while the content is being streamed the handler is told to stop receiving the current upload.Note, the usage of this method is not synchronized over the Application instance like other methods. The implementation should only return a boolean field and especially not modify UI or implement a synchronization by itself.
- Returns:
- true if the streaming should be interrupted as soon as possible.
-
UploadHandler
instead