Class UploadedFile
java.lang.Object
com.inductiveautomation.perspective.gateway.components.common.UploadedFile
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUploadedFile(String name, long size, org.apache.commons.io.output.DeferredFileOutputStream deferredContent) Instantiate a new UploadedFile instance backed by aDeferredFileOutputStream. -
Method Summary
-
Field Details
-
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 aDeferredFileOutputStream. 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
- Throws:
IOException
-
getBytes
- Throws:
IOException
-
getString
- Throws:
IOException
-
copyTo
- Throws:
IOException
-