@ThreadSafe public class AttachmentFileGetData extends Object implements AttachmentGetData
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
Constructor and Description |
---|
AttachmentFileGetData(File file) |
Modifier and Type | Method and Description |
---|---|
void |
close()
close the underlying input stream if this was and is open.
|
File |
getFile()
Size of file represented by this object, or 0 if the file does not exist or is directory
|
InputStream |
getInputStream()
Opens input stream for the file handled by this object.
|
long |
getSize() |
public AttachmentFileGetData(File file)
public File getFile()
public void close()
public long getSize()
getSize
in interface AttachmentGetData
public InputStream getInputStream()
close()
of this class. Closing the stream directly in not an error in this case method close
will be NOP.getInputStream
in interface AttachmentGetData
java.7lang.IllegalStateException
- if this method is called twice or close was called before this method.RuntimeIOException
- if this object points to not existing fileCopyright © 2002-2019 Atlassian. All Rights Reserved.