Interface AutoCloseable
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
BufferedInputStream, BufferedOutputStream, ConverterInputStream, ConverterOutputStream, DataInputStream, DataOutputStream, FileInputStream, FileIOStream, FileOutputStream, FilterInputStream, FilterInputStream.FilterInputStream$Impl, FilterOutputStream, FilterOutputStream.FilterOutputStream$Impl, InputStream, InputStream.InputStream$Impl, IOStream, IOStream.IOStream$Impl, MemoryInputStream, MemoryOutputStream, MultipartInputStream, OutputStream, OutputStream.OutputStream$Impl, PollableInputStream.PollableInputStream$Impl, PollableOutputStream.PollableOutputStream$Impl, SimpleIOStream, SocketConnection, TcpConnection, TcpWrapperConnection, TlsClientConnection.TlsClientConnection$Impl, TlsConnection, TlsConnection.TlsConnection$Impl, TlsServerConnection.TlsServerConnection$Impl, UnixConnection
An
AutoCloseable interface for GIO streams.
This interface extends AutoCloseable and implements
close() with a default method that calls
close(Cancellable). This interface is implemented by GIO streams
(IOStream, InputStream and OutputStream) so they
become AutoCloseable and can be used in a try-with-resources block.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()A default implementation ofAutoCloseablethat callsclose(Cancellable).booleanclose(@Nullable Cancellable cancellable)
-
Method Details
-
close
A default implementation ofAutoCloseablethat callsclose(Cancellable). The return value ofclose(Cancellable)is ignored.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- AnIOExceptionthat is wrapped around theGErrorExceptionthat is thrown byclose(Cancellable).
-
close
- Parameters:
cancellable- optionalCancellableobject,nullto ignore- Returns:
trueon success,falseon failure- Throws:
GErrorException- SeeGError
-