4 Replies Latest reply on Jun 3, 2007 3:05 PM by 807606

    InputStream do not read properly

    807606
      Hello,
      Can you say me, where I make a mistake.
      I am writing a proxy.When I read from InputStream in,
      like:
      try {
      byte[] buf = new byte[4096];
      int bytesIn = 0;
      while (((bytesIn = in.read(buf)) >= 0))
      {     
           String sss1 = new String(buf);
      out.write(buf, 0, bytesIn);
      }
      } catch (Exception e) {
      String errMsg = "Error getting HTTP body: " + e;
      debugOut.println(errMsg);
      }

      So,when I look in sss1 contents,there have extra information like:

      3




      79
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      3a
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <title>
      2d
      ..................

      The result is incorect page displaying.
      Can you say me, where I make a mistake.
      Or how I can remove this extra information, so the can to display corect in the browser.