Class NettyPartData

  • All Implemented Interfaces:
    io.micronaut.http.multipart.PartData

    @Internal
    public class NettyPartData
    extends java.lang.Object
    implements io.micronaut.http.multipart.PartData
    A Netty implementation of PartData.
    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      NettyPartData​(HttpDataReference httpData, HttpDataReference.Component component)  
      NettyPartData​(java.util.function.Supplier<java.util.Optional<io.micronaut.http.MediaType>> mediaTypeSupplier, io.micronaut.core.util.functional.ThrowingSupplier<io.netty.buffer.ByteBuf,​java.io.IOException> byteBufSupplier)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.netty.buffer.ByteBuf getByteBuf()  
      java.nio.ByteBuffer getByteBuffer()
      The contents of the chunk are released immediately.
      byte[] getBytes()
      The contents of the chunk are released immediately.
      java.util.Optional<io.micronaut.http.MediaType> getContentType()  
      java.io.InputStream getInputStream()
      The contents of the chunk will be released when the stream is closed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NettyPartData

        public NettyPartData​(java.util.function.Supplier<java.util.Optional<io.micronaut.http.MediaType>> mediaTypeSupplier,
                             io.micronaut.core.util.functional.ThrowingSupplier<io.netty.buffer.ByteBuf,​java.io.IOException> byteBufSupplier)
        Parameters:
        mediaTypeSupplier - The content type supplier
        byteBufSupplier - The byte buffer supplier
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        The contents of the chunk will be released when the stream is closed.
        Specified by:
        getInputStream in interface io.micronaut.http.multipart.PartData
        Throws:
        java.io.IOException
        See Also:
        PartData.getInputStream()
      • getBytes

        public byte[] getBytes()
                        throws java.io.IOException
        The contents of the chunk are released immediately.
        Specified by:
        getBytes in interface io.micronaut.http.multipart.PartData
        Throws:
        java.io.IOException
        See Also:
        PartData.getBytes()
      • getByteBuffer

        public java.nio.ByteBuffer getByteBuffer()
                                          throws java.io.IOException
        The contents of the chunk are released immediately.
        Specified by:
        getByteBuffer in interface io.micronaut.http.multipart.PartData
        Throws:
        java.io.IOException
        See Also:
        PartData.getByteBuffer()
      • getContentType

        public java.util.Optional<io.micronaut.http.MediaType> getContentType()
        Specified by:
        getContentType in interface io.micronaut.http.multipart.PartData
        See Also:
        PartData.getContentType()
      • getByteBuf

        public io.netty.buffer.ByteBuf getByteBuf()
                                           throws java.io.IOException
        Returns:
        The native netty ByteBuf for this chunk
        Throws:
        java.io.IOException - If an error occurs retrieving the buffer