Class CompletedAttribute

java.lang.Object
io.micronaut.http.multipart.CompletedPart
io.micronaut.http.multipart.CompletedAttribute
All Implemented Interfaces:
Closeable, AutoCloseable

public final class CompletedAttribute extends CompletedPart
A form field that is not a file upload.
  • Method Details

    • create

      public static CompletedAttribute create(FormFieldMetadata metadata, ReadBuffer readBuffer)
      Create a new memory-backed attribute. Ownership of the data buffer transfers to the attribute object. Closing the attribute object will close the memory.
      Parameters:
      metadata - The field metadata
      readBuffer - The attribute memory
      Returns:
      The attribute
    • isInMemory

      public boolean isInMemory()
      Specified by:
      isInMemory in class CompletedPart
    • getSize

      public long getSize()
      Description copied from class: CompletedPart
      Get the definite size in bytes of the form field value. Remains accessible after this part is closed.
      Specified by:
      getSize in class CompletedPart
      Returns:
      The size in bytes
    • getInputStream

      public InputStream getInputStream()
      Description copied from class: CompletedPart
      Open a new InputStream that reads this form field. The returned stream must be closed. You must still close this CompletedPart also.

      This is a blocking operation.

      Specified by:
      getInputStream in class CompletedPart
      Returns:
      A stream
    • toReadBuffer

      public ReadBuffer toReadBuffer()
      Description copied from class: CompletedPart
      Read all data of this form field into memory. The returned buffer must be closed after use. You must still close this CompletedPart also.

      This is a blocking operation.

      This operation has no size limit. If the uploaded file is large, calling this method may use a lot of memory.

      Specified by:
      toReadBuffer in class CompletedPart
      Returns:
      The buffered value
    • moveResource

      public CompletedPart moveResource()
      Description copied from class: CompletedPart
      The completed part objects passed to a controller are closed when the associated request ends. If you want to keep them around for longer, you can use this method to create a new CompletedPart with the same data. You are responsible for closing the new part.
      Specified by:
      moveResource in class CompletedPart
      Returns:
      A new completed part
    • closeAsync

      public void closeAsync(Executor ioExecutor)
      Description copied from class: CompletedPart
      Closeable.close() may be a blocking operation. This method closes this part asynchronously instead, on the given executor, if a blocking operation needs to be performed.
      Specified by:
      closeAsync in class CompletedPart
      Parameters:
      ioExecutor - The executor
    • close

      public void close()