Closeable interface in java

java.io.Closeable

It is an interface. A Closeable is a source or destination of data that can be closed. The close method is invoked to release resources that the object is holding (such as open files).

This contains one method. It extends the AutoCloseable interface.

Declaration:

public interface Closeable extends AutoCloseable {
        public void close() throws IOException;
}


Methods of Closeable interface

1. close()

void java.io.Closeable.close() throws IOException

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

Throws:

IOException - if an I/O error occurs


SuperInterface of Closeable:

AutoCloseable

SubInterfaces of Closeable:

AsynchronousByteChannel

AsynchronousChannel

ByteChannel

Channel

ImageInputStream

ImageOutputStream

MulticastChannel


Implementing Classes:

AbstractSelectableChannel

AbstractSelector

BufferedReader

BufferedWriter

BufferedInputStream

BufferedOutputStream

CheckedInputStream

CheckedOutputStream


Externalizable interface in Java

Flushable interface in Java

FilenameFilter interface in Java

FileFilter interface in Java

DataInput interface in Java

Closeable interface in java

Serializable interface in Java

ObjectInputValidation interface in Java

ObjectInputFilter interface in Java

DataOutput interface in Java

ObjectInput interface in Java

ObjectStreamConstants interface in Java

ObjectOutput interface in Java

No comments:

Post a Comment