I'm trying to send a string that contains some carriage returns to a servlet.

Right now what I'm doing is converting the contents of a file to bytes, then to a string. I write that string to a stream to the servlet.

But once I pull the string from the stream on the servlet, it looks like the formatting is lost.

Anyone know what I'm doing wrong? Thanks!!!!

This is the code I'm using to convert the data to bytes, then string:

Java Code:
File file = new File(inputPath+"/"+dataFile);
                                  byte[] b = this.getBytesFromFile(file);

                                  String rap = new String(b);
I then use this code to write to the stream:

Java Code:
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
                  out.write(rap);
                  out.flush();
                  out.close();
This is the code I have on the servlet to get the data off the stream:

Java Code:
InputStream in = request.getInputStream();

      BufferedReader inStream = new BufferedReader(new InputStreamReader(in));

      String line;
      StringBuffer xmlStrBuf = new StringBuffer();

        while((line = inStream.readLine()) != null) {
          xmlStrBuf.append(line);
        }
        String xml = xmlStrBuf.toString();
        out.println("Xml string:");
        out.println(xml);