Do I need to close InputStream after I close the Reader

前端 未结 5 994
面向向阳花
面向向阳花 2020-12-05 16:50

I was wondering, whether is there any need for me to close the InputStream, after I close the reader?

    try {
        inputStream = new java.io.FileInputSt         


        
5条回答
  •  不知归路
    2020-12-05 17:36

    You don't have to close stream, if you close() the reader.

    Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.

提交回复
热议问题