Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      java.io.IOException: Stream closed
      is thrown when processing a local file

      1-create a local file file:///exemple.txt
      2-get the input stream : is
      3-set a mark : is.mark(1024)
      4-read the file until the end
      5-reset the mark : is.reset()

      the exception is thrown

      here is a sample code :
      InputStream is = f.getInputStream();
      is.mark( 1024 );
      while (true)

      { int data = is.read(); if (data == -1) break; }

      is.reset();

        Issue Links

          Activity

          Hide
          moritz Moritz Siuts added a comment -

          I ran into the same problem.
          A workaround seems to be wrapping the InputStream into a BufferedInputStream, like here (using your sample):

          InputStream is = new BufferedInputStream(f.getInputStream());
          is.mark( 1024 );
          while (true)

          { int data = is.read(); if (data == -1) break; }

          is.reset();

          Show
          moritz Moritz Siuts added a comment - I ran into the same problem. A workaround seems to be wrapping the InputStream into a BufferedInputStream, like here (using your sample): InputStream is = new BufferedInputStream(f.getInputStream()); is.mark( 1024 ); while (true) { int data = is.read(); if (data == -1) break; } is.reset();
          Hide
          ralph.goers@dslextreme.com Ralph Goers added a comment -

          I'm curious as to how VFS could fix this issue. doGetInputStream just does

          return new FileInputStream(file);

          All interaction with the InputStream after that is handled by the JDK.

          Show
          ralph.goers@dslextreme.com Ralph Goers added a comment - I'm curious as to how VFS could fix this issue. doGetInputStream just does return new FileInputStream(file); All interaction with the InputStream after that is handled by the JDK.
          Hide
          ppoulard Philippe Poulard added a comment -

          Hi,

          I didn't dive into VFS for a while, but I remember there were some
          wrappers used around input streams; but I'm not sure...


          Cordialement,

          ///
          (. .)
          -------ooO(_)Ooo-------
          -----------------------------
          http://reflex.gforge.inria.fr/
          Have the RefleX !

          Show
          ppoulard Philippe Poulard added a comment - Hi, I didn't dive into VFS for a while, but I remember there were some wrappers used around input streams; but I'm not sure... – Cordialement, /// (. .) ------- ooO (_) Ooo ------- ----------------------------- http://reflex.gforge.inria.fr/ Have the RefleX !
          Hide
          ronanker Ronan KERDUDOU added a comment -

          Sorry for the link "block", can't undo it... I wanted to add a "clone" link.

          Show
          ronanker Ronan KERDUDOU added a comment - Sorry for the link "block", can't undo it... I wanted to add a "clone" link.
          Hide
          b.eckenfels Bernd Eckenfels added a comment -

          Do you think 301 is a duplicate of this?

          Show
          b.eckenfels Bernd Eckenfels added a comment - Do you think 301 is a duplicate of this?
          Hide
          b.eckenfels Bernd Eckenfels added a comment -

          I think clone is the wrong attribute.

          Show
          b.eckenfels Bernd Eckenfels added a comment - I think clone is the wrong attribute.

            People

            • Assignee:
              Unassigned
              Reporter:
              ppoulard Philippe Poulard
            • Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Development