7 Replies Latest reply on Sep 3, 2010 6:20 AM by EJP

    Closing Reader without Closing InputStream

      Currently, I have a method :
      void method(InputStream stream) {
          // Create UTF-8 reader by wrapping up the stream.
      The reason I do not want to have method to accept Reader is that, I want my own method to have own control to decide what type of encoding should be used.

      The problem is, whenever I close the Reader, InputStream will be closed as well. This is not my intention. As InputStream is "opened" by the caller. Hence, the closing operation on InputStream shall be done at caller side.

      Is there any way I can close the Reader in "method", without closing the InputStream passed by caller?