This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: java.io.PrintStream
- From: Mark Wielaard <mark at klomp dot org>
- To: Michael Koch <konqueror at gmx dot de>
- Cc: java-patches at gcc dot gnu dot org
- Date: 19 Jun 2003 15:26:25 +0200
- Subject: Re: Patch: java.io.PrintStream
- References: <200306171712.47672.konqueror@gmx.de>
Hi,
On Tue, 2003-06-17 at 17:12, Michael Koch wrote:
+ * java/io/PrintStream.java
+ (lineSeparator): New static member variable.
BufferedWriter always requests System.getProperty("line.separator") when
needed. But since PrintWriter also already has such a static field so I
guess that caching this value is OK. If so, then maybe BufferedWriter,
PrintWriter and PrintStream could share a package private static field
to store this value?
+ (print): Call print(String) instead of direct print method of the
+ Writer Object.
+ (println): Call println(String) instead of direct println method of the
+ Writer Object.
This seems to be slow in the case when you already have a char[]. In
that case you first create a new String object (that makes a copy of the
whole char[]) and then you finally end up in Writer.write(String) that
(see comment) turns the String into a new copy of the char array. That
seems a bit much overhead.
Cheers,
Mark