Class NettyCompletedFileUpload
- java.lang.Object
-
- io.micronaut.http.server.netty.multipart.NettyCompletedFileUpload
-
- All Implemented Interfaces:
io.micronaut.http.multipart.CompletedFileUpload,io.micronaut.http.multipart.CompletedPart,io.micronaut.http.multipart.FileUpload,io.micronaut.http.multipart.PartData
@Internal public class NettyCompletedFileUpload extends java.lang.Object implements io.micronaut.http.multipart.CompletedFileUploadA Netty implementation ofCompletedFileUpload.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description NettyCompletedFileUpload(io.netty.handler.codec.http.multipart.FileUpload fileUpload)NettyCompletedFileUpload(io.netty.handler.codec.http.multipart.FileUpload fileUpload, boolean controlRelease)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddiscard()java.nio.ByteBuffergetByteBuffer()Gets the content of this part as a ByteBuffer.byte[]getBytes()Gets the content of this part as a byte[].java.util.Optional<io.micronaut.http.MediaType>getContentType()longgetDefinedSize()java.lang.StringgetFilename()java.io.InputStreamgetInputStream()Gets the content of this part as a InputStream.java.lang.StringgetName()longgetSize()booleanisComplete()
-
-
-
Constructor Detail
-
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 Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionGets the content of this part as a InputStream.The contents of the file will be released when the stream is closed. This method should only be called once
- Specified by:
getInputStreamin interfaceio.micronaut.http.multipart.PartData- Returns:
- The content of this part as a InputStream
- Throws:
java.io.IOException- If an error occurs in retrieving the content
-
getBytes
public byte[] getBytes() throws java.io.IOExceptionGets the content of this part as a byte[].Because the contents of the file are released after being retrieved, this method can only be called once
- Specified by:
getBytesin interfaceio.micronaut.http.multipart.PartData- Returns:
- The content of this part as a byte[]
- Throws:
java.io.IOException- If an error occurs in retrieving the content
-
getByteBuffer
public java.nio.ByteBuffer getByteBuffer() throws java.io.IOExceptionGets the content of this part as a ByteBuffer.Because the contents of the file are released after being retrieved, this method can only be called once
- Specified by:
getByteBufferin interfaceio.micronaut.http.multipart.PartData- Returns:
- The content of this part as a ByteBuffer
- Throws:
java.io.IOException- If an error occurs in retrieving the content
-
getContentType
public java.util.Optional<io.micronaut.http.MediaType> getContentType()
- Specified by:
getContentTypein interfaceio.micronaut.http.multipart.FileUpload- Specified by:
getContentTypein interfaceio.micronaut.http.multipart.PartData
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceio.micronaut.http.multipart.CompletedPart- Specified by:
getNamein interfaceio.micronaut.http.multipart.FileUpload
-
getFilename
public java.lang.String getFilename()
- Specified by:
getFilenamein interfaceio.micronaut.http.multipart.FileUpload
-
getSize
public long getSize()
- Specified by:
getSizein interfaceio.micronaut.http.multipart.FileUpload
-
getDefinedSize
public long getDefinedSize()
- Specified by:
getDefinedSizein interfaceio.micronaut.http.multipart.FileUpload
-
isComplete
public boolean isComplete()
- Specified by:
isCompletein interfaceio.micronaut.http.multipart.FileUpload
-
discard
public final void discard()
- Specified by:
discardin interfaceio.micronaut.http.multipart.FileUpload
-
-