Package com.vaadin.flow.server.streams
Class TransferUtil
java.lang.Object
com.vaadin.flow.server.streams.TransferUtil
Utility class with methods for handling transfer of upload and download
requests.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intDefault buffer size for reading data from the input stream. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longtransfer(InputStream inputStream, OutputStream outputStream, TransferContext transferContext, Collection<TransferProgressListener> listeners) Transfers data from the given input stream to the output stream while notifying the progress to the given listeners.
-
Field Details
-
DEFAULT_BUFFER_SIZE
public static int DEFAULT_BUFFER_SIZEDefault buffer size for reading data from the input stream.Follows the default buffer size of the Java
InputStream.transferTo(OutputStream).
-
-
Constructor Details
-
TransferUtil
public TransferUtil()
-
-
Method Details
-
transfer
public static long transfer(InputStream inputStream, OutputStream outputStream, TransferContext transferContext, Collection<TransferProgressListener> listeners) throws IOException Transfers data from the given input stream to the output stream while notifying the progress to the given listeners.- Parameters:
inputStream- the input stream to read fromoutputStream- the output stream to write totransferContext- the transfer request containing metadata about the transferlisteners- collection of listeners to notify about progress- Returns:
- the number of bytes transferred
- Throws:
IOException- if an I/O error occurs during the transfer
-