Record Class UploadedFilePart

java.lang.Object
java.lang.Record
com.inductiveautomation.perspective.gateway.util.UploadedFilePart
All Implemented Interfaces:
AutoCloseable

public record UploadedFilePart(String fileId, String contentType, long size, org.apache.commons.io.output.DeferredFileOutputStream deferredContent) extends Record implements AutoCloseable
A multipart file part that has been buffered into a DeferredFileOutputStream. The part's submitted filename is the client-generated FileId; the owning field id and the user-facing display name are recovered from the submission JSON via FileSubmissionIndex when FormFiles.groupByField(java.util.List<com.inductiveautomation.perspective.gateway.util.UploadedFilePart>, java.util.Map<java.lang.String, com.inductiveautomation.perspective.gateway.util.FileSubmissionIndex.FieldFileEntry>) promotes parts to UploadedFiles.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UploadedFilePart(String fileId, String contentType, long size, org.apache.commons.io.output.DeferredFileOutputStream deferredContent)
    Creates an instance of a UploadedFilePart record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the underlying stream and deletes any temporary file written to disk.
    Returns the value of the contentType record component.
    org.apache.commons.io.output.DeferredFileOutputStream
    Returns the value of the deferredContent record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the fileId record component.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the size record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UploadedFilePart

      public UploadedFilePart(String fileId, String contentType, long size, org.apache.commons.io.output.DeferredFileOutputStream deferredContent)
      Creates an instance of a UploadedFilePart record class.
      Parameters:
      fileId - the value for the fileId record component
      contentType - the value for the contentType record component
      size - the value for the size record component
      deferredContent - the value for the deferredContent record component
  • Method Details

    • close

      public void close()
      Closes the underlying stream and deletes any temporary file written to disk. Safe to call multiple times.
      Specified by:
      close in interface AutoCloseable
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fileId

      public String fileId()
      Returns the value of the fileId record component.
      Returns:
      the value of the fileId record component
    • contentType

      public String contentType()
      Returns the value of the contentType record component.
      Returns:
      the value of the contentType record component
    • size

      public long size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • deferredContent

      public org.apache.commons.io.output.DeferredFileOutputStream deferredContent()
      Returns the value of the deferredContent record component.
      Returns:
      the value of the deferredContent record component