- All Known Subinterfaces:
public interface DisposableA
Disposableis an object data that can be disposed once it is not needed anymore. Similar to
Closeable.close()this method is invoked to release resources that the object is holding but there is an important difference. After a
Closeableis closed it can typically be reused. For example, a file can be read later after it is closed. However,
disposeindicated that the resource would never be used again; so, if there is a file associated with the object the file could be deleted or overwritten as needed by other tasks.
- Evren Sirin
void dispose()Dispose the resources held by this object. Use this function with care since disposed objects cannot be reused again. If the resources (files, pages, etc.) held by this object will be needed again calling
Closeable.close()or some other method will be more appropriate.