If any reader or stream decorates another reader / stream, then closing the outside also closes the inside. This can be done from the Javadoc Closeable#close() :
Closes this thread and allocates any associated system resources .
This also applies to core resources.
If you are very curious, you can delve into the sources of these classes, for example. in BufferedReader :
public void close() throws IOException { synchronized (lock) { if (in == null) return; try { in.close(); } finally { in = null; cb = null; } } }
where in is the base Reader .
source share