Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: unspecified
    • Fix Version/s: 4.1.1
    • Component/s: Documentation
    • Labels:
      None

      Description

      Method InputStream.read(buffer) returns number of bytes read into the buffer.

      Tapestry FAQ contains example "How do I stream a file to the user from tapestry?":
      byte[] data = new byte[1024];
      ...
      while (in.read(data) > -1)

      { out.write(data); }

      =============
      It should be something like:
      int len;
      while ((len = in.read(data)) > -1)

      { out.write(data, 0, len); }

      =============
      Or I'm wrong and response.setContentLength() will handle this?

      Tapestry FAQ:
      http://jakarta.apache.org/tapestry/faq.html#faq-N1012F

        Activity

        Hide
        fidlej Ivo Danihelka added a comment -

        Now I'm sure that the example in FAQ is definitely wrong because
        the "in.read(data)" can read less bytes not only at the end of file.

        Show
        fidlej Ivo Danihelka added a comment - Now I'm sure that the example in FAQ is definitely wrong because the "in.read(data)" can read less bytes not only at the end of file.
        Hide
        vaporrun Brian K. Wallace added a comment -

        This has already been addressed.

        Show
        vaporrun Brian K. Wallace added a comment - This has already been addressed.

          People

          • Assignee:
            Unassigned
            Reporter:
            fidlej Ivo Danihelka
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development