public class Closer extends Object
null before invoking the close()
method of the respective type.| Constructor and Description |
|---|
Closer() |
| Modifier and Type | Method and Description |
|---|---|
static void |
close(Closeable closeable)
Closes the given
Closeable, flush(Object)ing it first. |
static void |
close(Connection connection)
Closes the given connection.
|
static void |
close(InputStream inputStream)
Closes the given input stream.
|
static void |
close(JarFile jarFile)
Closes the given jar file.
|
static void |
close(Object object)
Tries to call the close() method on the given object.
|
static void |
close(OutputStream outputStream)
Closes the given output stream.
|
static void |
close(Reader reader)
Closes the given reader.
|
static void |
close(ResultSet resultSet)
Closes the given result set.
|
static void |
close(ServerSocket serverSocket)
Closes the given server socket.
|
static void |
close(Socket socket)
Closes the given socket.
|
static void |
close(Statement statement)
Closes the given statement.
|
static void |
close(Writer writer)
Closes the given writer.
|
static void |
flush(Flushable flushable)
Flushes the given flushable, swallowing any
IOException that may
occur. |
static void |
flush(Object object)
Flushes the given object by calling a method called “flush” without
parameters, swallowing any
IOException that may occur. |
public static void close(ResultSet resultSet)
resultSet - The result set to closeResultSet.close()public static void close(Statement statement)
statement - The statement to closeStatement.close()public static void close(Connection connection)
connection - The connection to closeConnection.close()public static void close(ServerSocket serverSocket)
serverSocket - The server socket to closeServerSocket.close()public static void close(Socket socket)
socket - The socket to closeSocket.close()public static void close(InputStream inputStream)
inputStream - The input stream to closeInputStream.close()public static void close(OutputStream outputStream)
outputStream - The output stream to closeOutputStream.close()public static void close(Reader reader)
reader - The reader to closeReader.close()public static void close(Writer writer)
writer - The write to closeWriter.close()public static void close(JarFile jarFile)
jarFile - The JAR file to closeZipFile.close()public static void close(Closeable closeable)
Closeable, flush(Object)ing it first.closeable - The Closeable to closeCloseable.close()public static void close(Object object)
object - The object to call the close() method onpublic static void flush(Flushable flushable)
IOException that may
occur.flushable - The flushablepublic static void flush(Object object)
IOException that may occur.object - The object to flushCopyright © 2026. All rights reserved.