Class AttachmentFileGetData
java.lang.Object
com.atlassian.jira.issue.attachment.AttachmentFileGetData
- All Implemented Interfaces:
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
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionAttachmentFileGetData
(com.atlassian.dc.filestore.api.FileStore.Path fileStorePath) Create an instance that does not track transfer performance analytics.AttachmentFileGetData
(com.atlassian.dc.filestore.api.FileStore.Path fileStorePath, StreamAttachmentStoreStats streamAttachmentStoreStats, FileStoreAnalyticInfo fileStoreAnalyticInfo) IfStreamAttachmentStoreStats
is provided the return input stream will be wrapped in aAttachmentFileGetData.AttachmentStatsInputStream
which will record transfer stats. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
close the underlying input stream if this was and is open.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 directoryOpens input stream for the file handled by this object.long
getSize()
-
Constructor Details
-
AttachmentFileGetData
public AttachmentFileGetData(com.atlassian.dc.filestore.api.FileStore.Path fileStorePath) Create an instance that does not track transfer performance analytics. -
AttachmentFileGetData
public AttachmentFileGetData(com.atlassian.dc.filestore.api.FileStore.Path fileStorePath, @Nullable StreamAttachmentStoreStats streamAttachmentStoreStats, @Nullable FileStoreAnalyticInfo fileStoreAnalyticInfo) IfStreamAttachmentStoreStats
is provided the return input stream will be wrapped in aAttachmentFileGetData.AttachmentStatsInputStream
which will record transfer stats.
-
-
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 interfaceAttachmentGetData
-
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 methodclose()
of this class. Closing the stream directly in not an error in this case method close will be NOP.- Specified by:
getInputStream
in interfaceAttachmentGetData
- Throws:
RuntimeIOException
- if this object points to not existing file
-