Author: alessio.soldano(a)jboss.com
Date: 2008-05-02 13:44:55 -0400 (Fri, 02 May 2008)
New Revision: 6870
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
Log:
[JBWS-2172] Avoid using BufferedReader's readLine() to preserve carriage returns
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2008-05-02
16:33:45 UTC (rev 6869)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2008-05-02
17:44:55 UTC (rev 6870)
@@ -290,17 +290,12 @@
Object converted = null;
try
{
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- StringBuilder sb = new StringBuilder();
- String line = null;
-
- while ((line = br.readLine()) != null) {
- sb.append(line + "\n");
+ StringBuilder out = new StringBuilder();
+ byte[] b = new byte[4096];
+ for (int n; (n = in.read(b)) != -1;) {
+ out.append(new String(b, 0, n));
}
-
- br.close();
-
- converted = sb.toString();
+ converted = out.toString();
}
catch (IOException e)
{
Show replies by date