Class 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.CompletedFileUpload
    A Netty implementation of CompletedFileUpload.
    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)  
    • 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 upload
        controlRelease - If true, release after retrieving the data
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Gets 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:
        getInputStream in interface io.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.IOException
        Gets 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:
        getBytes in interface io.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.IOException
        Gets 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:
        getByteBuffer in interface io.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:
        getContentType in interface io.micronaut.http.multipart.FileUpload
        Specified by:
        getContentType in interface io.micronaut.http.multipart.PartData
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface io.micronaut.http.multipart.CompletedPart
        Specified by:
        getName in interface io.micronaut.http.multipart.FileUpload
      • getFilename

        public java.lang.String getFilename()
        Specified by:
        getFilename in interface io.micronaut.http.multipart.FileUpload
      • getSize

        public long getSize()
        Specified by:
        getSize in interface io.micronaut.http.multipart.FileUpload
      • getDefinedSize

        public long getDefinedSize()
        Specified by:
        getDefinedSize in interface io.micronaut.http.multipart.FileUpload
      • isComplete

        public boolean isComplete()
        Specified by:
        isComplete in interface io.micronaut.http.multipart.FileUpload
      • discard

        public final void discard()
        Specified by:
        discard in interface io.micronaut.http.multipart.FileUpload