java.lang.Object
com.inductiveautomation.perspective.gateway.components.common.UploadedFile

public class UploadedFile extends Object
  • Field Details

    • name

      public final String name
    • size

      public final long size
  • Constructor Details

    • UploadedFile

      public UploadedFile(String name, long size, org.apache.commons.io.output.DeferredFileOutputStream deferredContent)
      Instantiate a new UploadedFile instance backed by a DeferredFileOutputStream. Bytes are read lazily the first time a method accesses the file's content, at which point the stream is consumed, the result is cached, and any temporary file written to disk is deleted.

      Callers must ensure close() is called after the event handler returns to release resources in the case where no methods are ever invoked on this instance.

      Parameters:
      name - The submitted filename from the multi-part request.
      size - The size in bytes of the uploaded file.
      deferredContent - The buffered content from the Part's input stream.
  • Method Details

    • close

      public void close()
      Closes the underlying stream and deletes any temporary file written to disk. Safe to call multiple times and safe to call after the content has already been materialized via one of the read methods.
    • getInputStream

      public InputStream getInputStream() throws IOException
      Throws:
      IOException
    • getBytes

      public byte[] getBytes() throws IOException
      Throws:
      IOException
    • getString

      public String getString(org.python.core.PyObject[] pyArgs, String[] keywords) throws IOException
      Throws:
      IOException
    • copyTo

      public void copyTo(org.python.core.PyObject[] pyArgs, String[] keywords) throws IOException
      Throws:
      IOException