@FunctionalInterface public interface InputStreamFactory extends Serializable
StreamResource.
 
 The instance of this class should generate InputStream for the
 resource.
| Modifier and Type | Method and Description | 
|---|---|
InputStream | 
createInputStream()
Produce  
InputStream instance to read resource data. | 
default boolean | 
requiresLock()
If this method returns  
true (by default) then reading data from
 input stream (via createInputStream() will be done under session
 lock and it's safe to access application data within InputStream
 read methods. | 
InputStream createInputStream()
InputStream instance to read resource data.
 
 This method is called under the Vaadin session lock. So it's safe to
 access the application/session data which is required to produce the
 InputStream data. The presence of the lock on subsequent access
 to the InputStream is controlled by requiresLock()
 method. So createInputStream() method is the best place to do
 your InputStream initialization.
 
Return value may not be null.
default boolean requiresLock()
true (by default) then reading data from
 input stream (via createInputStream() will be done under session
 lock and it's safe to access application data within InputStream
 read methods. Otherwise session lock won't be acquired. In the latter
 case one must not try to access application data.
 
 createInputStream() is called under the session lock. Normally
 it should be enough to get all required data from the application at this
 point and use it to produce the data via InputStream. In this
 case one should override requiresLock() method to return
 false. E.g. if InputStream instance is remote URL input
 stream then you don't want to lock session on reading data from it.
true if data from the input stream should be read under
         the session lock, false otherwiseCopyright © 2021. All rights reserved.