Interface Disposable

  • All Known Subinterfaces:
    AutoDisposable
    All Known Implementing Classes:
    AbstractAutoDisposable, CancellationManager, Disposer

    public interface Disposable
    A Disposable is 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 Closeable is closed it can typically be reused. For example, a file can be read later after it is closed. However, dispose indicated 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.
    Author:
    Evren Sirin
    • Method Detail

      • dispose

        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.