Number of attachments :
There is no way to close the InputStream that is wrapped by SmartEncodingInputStream in it's constructor by calling close() on SmartEncodingInputStream.
One effect of this is that you cannot move a file that has been read by SmartEncodingInputStream until the wrapped InputStream is garbage collected, which is not deterministic!
A common approach when wrapping an InputStream in another InputStream (here: SmartEncodingInputStream) is to provide an overriden close() method that simply delegates to close() of the wrapped InputStream.
Please implement such an overridden close() method in SmartEncodingInputStream.
(Ugly) Workaround until fix has been delivered:
Remember wrapped InputStream and directly call close() on it and do not rely on SmartEncodingInputStream.close().