public interface Disposable
dispose()
method allows any resources held by this object to be released.
The result of calling any other method subsequent to a call to this method is undefined.
Data integrity shall not depend on dispose()
method invocation.
If some data may need to be flushed to a stream
or committed to a database,
then a close()
method should be used instead.
Closeable
Disposeable
and Closeable
interfaces.
While very similar, those two interfaces serve slightly different purposes. The Closeable
interface closes a stream or a connection, but some classes allow the object to be reused with a
different stream. However once an object has been disposed, it can not be used anymore.
ImageReader
and ImageWriter
allow to reuse the same instance
many times for reading or writing different images in the same format. New streams can be created, given
to the ImageReader
or ImageWriter
and closed many times as long as dispose()
has
not been invoked.dispose()
does not throw any checked exception.
That method may be invoked in a background thread performing cleanup tasks,
which would not know what to do in case of failure.
Error during dispose()
execution should not result in any lost of data.Graphics.dispose()
,
ImageReader.dispose()
,
ImageWriter.dispose()
Defined in the sis-utility
module
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Allows any resources held by this object to be released.
|
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.