Class AttachmentFileGetData

java.lang.Object
com.atlassian.jira.issue.attachment.AttachmentFileGetData
All Implemented Interfaces:
AttachmentGetData

@ThreadSafe public class AttachmentFileGetData extends Object implements AttachmentGetData
Represents attachment data. The method getInputStream() can be called only once for each instance of this object. Method close() can be called multiple times. This class is thread safe, that means that getInputStream and close can be called from two threads, and when multiple threads try to call getInputStream only one will succeed and other will receive IllegalStateException
Since:
v6.4
  • Constructor Details

  • Method Details

    • getFile

      public com.atlassian.dc.filestore.api.FileStore.Path getFile()
      Size of file represented by this object, or 0 if the file does not exist or is directory
      Returns:
      file object represented by this object.
    • close

      public void close()
      close the underlying input stream if this was and is open. NOP in other cases.
    • getSize

      public long getSize()
      Specified by:
      getSize in interface AttachmentGetData
    • getInputStream

      public InputStream getInputStream()
      Opens input stream for the file handled by this object. One can call this method only once for instance of this object. To close the stream use method close() of this class. Closing the stream directly in not an error in this case method close will be NOP.
      Specified by:
      getInputStream in interface AttachmentGetData
      Throws:
      RuntimeIOException - if this object points to not existing file