Class NettyCompletedFileUpload
java.lang.Object
io.micronaut.http.server.netty.multipart.NettyCompletedFileUpload
- All Implemented Interfaces:
CompletedFileUpload,CompletedPart,FileUpload,PartData
A Netty implementation of
CompletedFileUpload.- Since:
- 1.0.0
- Author:
- Zachary Klein
-
Constructor Summary
ConstructorsConstructorDescriptionNettyCompletedFileUpload(io.netty.handler.codec.http.multipart.FileUpload fileUpload) NettyCompletedFileUpload(io.netty.handler.codec.http.multipart.FileUpload fileUpload, boolean controlRelease) -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddiscard()Discards the contents of the file.Gets the content of this part as aByteBuffer.byte[]getBytes()Gets the content of this part as abyte[].Gets the content type of this part.longReturns the defined content length of the part.Gets the name of this part.Gets the content of this part as aInputStream.getName()Gets the name of this part.longgetSize()Returns the size of the part.booleanReturns whether theFileUploadhas been fully uploaded or is in a partial state.
-
Constructor Details
-
NettyCompletedFileUpload
public NettyCompletedFileUpload(io.netty.handler.codec.http.multipart.FileUpload fileUpload) - Parameters:
fileUpload- The file upload
-
NettyCompletedFileUpload
public NettyCompletedFileUpload(io.netty.handler.codec.http.multipart.FileUpload fileUpload, boolean controlRelease) - Parameters:
fileUpload- The file uploadcontrolRelease- If true, release after retrieving the data
-
-
Method Details
-
getInputStream
Gets the content of this part as aInputStream.The contents of the file will be released when the stream is closed. This method should only be called once
- Specified by:
getInputStreamin interfacePartData- Returns:
- The content of this part as a
InputStream - Throws:
IOException- If an error occurs in retrieving the content
-
getBytes
Gets the content of this part as abyte[].Because the contents of the file are released after being retrieved, this method can only be called once
- Specified by:
getBytesin interfacePartData- Returns:
- The content of this part as a
byte[] - Throws:
IOException- If an error occurs in retrieving the content
-
getByteBuffer
Gets the content of this part as aByteBuffer.Because the contents of the file are released after being retrieved, this method can only be called once
- Specified by:
getByteBufferin interfacePartData- Returns:
- The content of this part as a
ByteBuffer - Throws:
IOException- If an error occurs in retrieving the content
-
getContentType
Description copied from interface:FileUploadGets the content type of this part.- Specified by:
getContentTypein interfaceFileUpload- Specified by:
getContentTypein interfacePartData- Returns:
- The content type of this part.
-
getName
Description copied from interface:FileUploadGets the name of this part.- Specified by:
getNamein interfaceCompletedPart- Specified by:
getNamein interfaceFileUpload- Returns:
- The name of this part
-
getFilename
Description copied from interface:FileUploadGets the name of this part.- Specified by:
getFilenamein interfaceFileUpload- Returns:
- The name of this part
-
getSize
public long getSize()Description copied from interface:FileUploadReturns the size of the part.- Specified by:
getSizein interfaceFileUpload- Returns:
- The size of this part, in bytes.
-
getDefinedSize
public long getDefinedSize()Description copied from interface:FileUploadReturns the defined content length of the part.- Specified by:
getDefinedSizein interfaceFileUpload- Returns:
- The content length of this part, in bytes.
-
isComplete
public boolean isComplete()Description copied from interface:FileUploadReturns whether theFileUploadhas been fully uploaded or is in a partial state.- Specified by:
isCompletein interfaceFileUpload- Returns:
- True if the part is fully uploaded
-
discard
public final void discard()Description copied from interface:FileUploadDiscards the contents of the file. This must be called if the file will not be read and has not already been read. Failure to either read or discard the file will result in memory leaks!- Specified by:
discardin interfaceFileUpload
-