I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit 7ff6373d authored by zzz's avatar zzz
Browse files

Output stream to string optimizations

parent 3bf3a4ff
No related branches found
No related tags found
No related merge requests found
package net.i2p.router.web.helpers;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Date;
......@@ -28,9 +27,9 @@ public class OldConsoleHelper extends HelperBase {
renderStatusHTML(_out);
return "";
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream(2*1024);
renderStatusHTML(new OutputStreamWriter(baos));
return baos.toString();
StringWriter sw = new StringWriter(2*1024);
renderStatusHTML(sw);
return sw.toString();
}
} catch (IOException ioe) {
return "<b>Error displaying the console.</b>";
......@@ -44,9 +43,9 @@ public class OldConsoleHelper extends HelperBase {
gen.generateStatsPage(_out, _full);
return "";
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream(32*1024);
gen.generateStatsPage(new OutputStreamWriter(baos), _full);
return baos.toString();
StringWriter sw = new StringWriter(32*1024);
gen.generateStatsPage(sw, _full);
return sw.toString();
}
} catch (IOException ioe) {
return "<b>Error displaying the console.</b>";
......
......@@ -2828,7 +2828,7 @@ public class WebMail extends HttpServlet
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
draft.getPart().outputRaw(baos);
body.append(new String(baos.toByteArray(), "ISO-8859-1"));
body.append(baos.toString("ISO-8859-1"));
} catch (IOException ioe) {
ok = false;
sessionObject.error += ioe.getMessage() + '\n';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment