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 Object implements io.micronaut.http.multipart.CompletedFileUpload
A Netty implementation of CompletedFileUpload.
Since:
1.0.0
  • 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 upload
      controlRelease - If true, release after retrieving the data
  • Method Details

    • getInputStream

      public InputStream getInputStream() throws 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:
      IOException - If an error occurs in retrieving the content
    • getBytes

      public byte[] getBytes() throws 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:
      IOException - If an error occurs in retrieving the content
    • getByteBuffer

      public ByteBuffer getByteBuffer() throws 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:
      IOException - If an error occurs in retrieving the content
    • getContentType

      public 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 String getName()
      Specified by:
      getName in interface io.micronaut.http.multipart.CompletedPart
      Specified by:
      getName in interface io.micronaut.http.multipart.FileUpload
    • getFilename

      public 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