@Internal public class NettyStreamingFileUpload extends Object implements StreamingFileUpload
StreamingFileUpload
interface for Netty.Constructor and Description |
---|
NettyStreamingFileUpload(io.netty.handler.codec.http.multipart.FileUpload httpData,
HttpServerConfiguration.MultipartConfiguration multipartConfiguration,
ExecutorService ioExecutor,
reactor.core.publisher.Flux<PartData> subject) |
Modifier and Type | Method and Description |
---|---|
protected File |
createTemp(String location) |
Publisher<Boolean> |
delete()
Deletes the underlying storage for a file item, including deleting any associated temporary disk file.
|
void |
discard()
Discards the contents of the file.
|
Optional<MediaType> |
getContentType()
Gets the content type of this part.
|
long |
getDefinedSize()
Returns the defined content length of the part.
|
String |
getFilename()
Gets the name of this part.
|
String |
getName()
Gets the name of this part.
|
long |
getSize()
Returns the size of the part.
|
boolean |
isComplete()
Returns whether the
FileUpload has been fully uploaded or is in a partial state. |
void |
subscribe(Subscriber<? super PartData> s) |
Publisher<Boolean> |
transferTo(File destination)
A convenience method to write this uploaded item to disk.
|
Publisher<Boolean> |
transferTo(OutputStream outputStream)
A convenience method to write this uploaded item the provided output stream.
|
Publisher<Boolean> |
transferTo(String location)
A convenience method to write this uploaded item to disk.
|
public NettyStreamingFileUpload(io.netty.handler.codec.http.multipart.FileUpload httpData, HttpServerConfiguration.MultipartConfiguration multipartConfiguration, ExecutorService ioExecutor, reactor.core.publisher.Flux<PartData> subject)
httpData
- The file upload (the data)multipartConfiguration
- The multipart configurationioExecutor
- The IO executorsubject
- The subjectpublic Optional<MediaType> getContentType()
FileUpload
getContentType
in interface FileUpload
public String getName()
FileUpload
getName
in interface FileUpload
public String getFilename()
FileUpload
getFilename
in interface FileUpload
public long getSize()
FileUpload
getSize
in interface FileUpload
public long getDefinedSize()
FileUpload
getDefinedSize
in interface FileUpload
public boolean isComplete()
FileUpload
FileUpload
has been fully uploaded or is in a partial state.isComplete
in interface FileUpload
public Publisher<Boolean> transferTo(String location)
StreamingFileUpload
A convenience method to write this uploaded item to disk.
This method will return a no-op Publisher
if called multiple times for the same location
transferTo
in interface StreamingFileUpload
location
- the name of the file to which the stream will be written. The file is created relative to
the location as specified in the MultipartConfiguration
Publisher
that outputs whether the transfer was successfulpublic Publisher<Boolean> transferTo(File destination)
StreamingFileUpload
A convenience method to write this uploaded item to disk.
This method will return a no-op Publisher
if called multiple times for the same location
transferTo
in interface StreamingFileUpload
destination
- the destination of the file to which the stream will be written.Publisher
that outputs whether the transfer was successfulpublic Publisher<Boolean> transferTo(OutputStream outputStream)
StreamingFileUpload
A convenience method to write this uploaded item the provided output stream.
transferTo
in interface StreamingFileUpload
outputStream
- the destination to which the stream will be written.Publisher
that outputs whether the transfer was successfulpublic Publisher<Boolean> delete()
StreamingFileUpload
delete
in interface StreamingFileUpload
Publisher
that outputs whether the delete was successfulprotected File createTemp(String location)
location
- The location for the temp filepublic void subscribe(Subscriber<? super PartData> s)
public void discard()
FileUpload
discard
in interface FileUpload