forked from I2P_Developers/i2p.i2p
Output stream to string optimizations
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
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';
|
||||
|
||||
Reference in New Issue
Block a user