<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Two things I hate about Java I/O</title>
	<atom:link href="http://madbean.com/2004/mb2004-29/feed/" rel="self" type="application/rss+xml" />
	<link>http://madbean.com/2004/mb2004-29/</link>
	<description>Your zero step program</description>
	<pubDate>Fri, 05 Sep 2008 17:09:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Anonymous Coward</title>
		<link>http://madbean.com/2004/mb2004-29/#comment-273</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Thu, 09 Dec 2004 22:52:53 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2004-29#comment-273</guid>
		<description>&lt;p&gt;&#62; If FilterWriter meant you yo override one method&lt;/p&gt;

&lt;p&gt;I was going to mention the same thing, except that FilterWriter misses a couple other write methods.  So, someone could extend your class, or change the behavior of those other methods and you'd be in the same boat.&lt;/p&gt;

&lt;p&gt;OTOH, designing for inheritence is tough and this stuff is from JDK 1.1.  I do hope that someone goes though and defines exactly how these classes should be extended, like we have in the Collections classes.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&gt; If FilterWriter meant you yo override one method</p>
<p>I was going to mention the same thing, except that FilterWriter misses a couple other write methods.  So, someone could extend your class, or change the behavior of those other methods and you&#8217;d be in the same boat.</p>
<p>OTOH, designing for inheritence is tough and this stuff is from JDK 1.1.  I do hope that someone goes though and defines exactly how these classes should be extended, like we have in the Collections classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous Coward</title>
		<link>http://madbean.com/2004/mb2004-29/#comment-272</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Thu, 09 Dec 2004 22:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2004-29#comment-272</guid>
		<description>&lt;p&gt;Well... OK, but I don't see a huge win.  Writer.write(String str, int off, int len) only uses that writeBuffer if the len is 1024 or less.  But your suggestion does eliminate a double allocation of len chars.  Currently, one array is allocated backing the String creation in in append() and another is the array allocated in that write() call (to be used instead of the writeBuffer).  So even with your suggestion, depending upon the size of your file, you'll be in trouble, but at least you won't be in double trouble. :)&lt;/p&gt;

&lt;p&gt;Hey, your idea seems like the perfect RFE/bug request for Mustang (or even JDK 1.5.next_minor).  It'd be a kinda minor enhancment for most usage, but every bit counts.&lt;/p&gt;

&lt;p&gt;In any case though, it seems to me you'll have to override append to read from CharSequence and write a block at a time.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Well&#8230; OK, but I don&#8217;t see a huge win.  Writer.write(String str, int off, int len) only uses that writeBuffer if the len is 1024 or less.  But your suggestion does eliminate a double allocation of len chars.  Currently, one array is allocated backing the String creation in in append() and another is the array allocated in that write() call (to be used instead of the writeBuffer).  So even with your suggestion, depending upon the size of your file, you&#8217;ll be in trouble, but at least you won&#8217;t be in double trouble. :)</p>
<p>Hey, your idea seems like the perfect RFE/bug request for Mustang (or even JDK 1.5.next_minor).  It&#8217;d be a kinda minor enhancment for most usage, but every bit counts.</p>
<p>In any case though, it seems to me you&#8217;ll have to override append to read from CharSequence and write a block at a time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous Coward</title>
		<link>http://madbean.com/2004/mb2004-29/#comment-271</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Thu, 09 Dec 2004 22:39:55 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2004-29#comment-271</guid>
		<description>&lt;p&gt;If FilterWriter meant you yo override one method, the other write methods would have declared final.  You are relying on some observed behaviour with another class and assuming that just because some other class implemented those methods to delegate to the single method that everything else should.  In fact your code previously sounds like it is wrong.  What would happen on the IBM JDK?  GNU Classpath?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If FilterWriter meant you yo override one method, the other write methods would have declared final.  You are relying on some observed behaviour with another class and assuming that just because some other class implemented those methods to delegate to the single method that everything else should.  In fact your code previously sounds like it is wrong.  What would happen on the IBM JDK?  GNU Classpath?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Quail</title>
		<link>http://madbean.com/2004/mb2004-29/#comment-270</link>
		<dc:creator>Matt Quail</dc:creator>
		<pubDate>Thu, 09 Dec 2004 21:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2004-29#comment-270</guid>
		<description>&lt;p&gt;&#62; What else would they do?  Write a char at a time?&lt;/p&gt;

&lt;p&gt;Have a look at the implementation of write(String str, int off, int len) in Writer... Writer already has a char[] writeBuffer it uses to efficiently write out a String, that exact same code could be used for a CharSequence (replacing String with CharSequence) (infact, write(String) could then just call write(CharSequence) without a loss of semantics).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&gt; What else would they do?  Write a char at a time?</p>
<p>Have a look at the implementation of write(String str, int off, int len) in Writer&#8230; Writer already has a char[] writeBuffer it uses to efficiently write out a String, that exact same code could be used for a CharSequence (replacing String with CharSequence) (infact, write(String) could then just call write(CharSequence) without a loss of semantics).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous Coward</title>
		<link>http://madbean.com/2004/mb2004-29/#comment-269</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Thu, 09 Dec 2004 17:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2004-29#comment-269</guid>
		<description>&lt;p&gt;&#62; They all call .toString() on the CharSequence argument. 
&#62; Doesn't that negate the whole point of CharSequence's existence?!?&lt;/p&gt;

&lt;p&gt;What else would they do?  Write a char at a time?  Then almost everyone else would complain that append() is too inefficient since appending huge files via CharSequence isn't the norm.  BTW: I think CharSequence is around for Formatting, not for generics (but if it is around for generics, I'd love to know why).&lt;/p&gt;

&lt;p&gt;&#62; You are much better off just subclassing Writer. FilterWriter is a joke.&lt;/p&gt;

&lt;p&gt;Well, they do provide the Writer delegate, the close, and the flush for you.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&gt; They all call .toString() on the CharSequence argument.<br />
&gt; Doesn&#8217;t that negate the whole point of CharSequence&#8217;s existence?!?</p>
<p>What else would they do?  Write a char at a time?  Then almost everyone else would complain that append() is too inefficient since appending huge files via CharSequence isn&#8217;t the norm.  BTW: I think CharSequence is around for Formatting, not for generics (but if it is around for generics, I&#8217;d love to know why).</p>
<p>&gt; You are much better off just subclassing Writer. FilterWriter is a joke.</p>
<p>Well, they do provide the Writer delegate, the close, and the flush for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Quail</title>
		<link>http://madbean.com/2004/mb2004-29/#comment-268</link>
		<dc:creator>Matt Quail</dc:creator>
		<pubDate>Wed, 08 Dec 2004 21:51:55 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2004-29#comment-268</guid>
		<description>&lt;p&gt;Bruce: That is probably true, but that does not (in the least) require Writer to call .toString() on the CharSequences.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Bruce: That is probably true, but that does not (in the least) require Writer to call .toString() on the CharSequences.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce Eckel</title>
		<link>http://madbean.com/2004/mb2004-29/#comment-267</link>
		<dc:creator>Bruce Eckel</dc:creator>
		<pubDate>Wed, 08 Dec 2004 17:05:46 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2004-29#comment-267</guid>
		<description>&lt;p&gt;I believe the goal of Appendable was to aid in dealing with generics. See:
http://mindview.net/WebLog/log-0061
And
http://mindview.net/WebLog/log-0064&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I believe the goal of Appendable was to aid in dealing with generics. See:<br />
<a href="http://mindview.net/WebLog/log-0061" rel="nofollow">http://mindview.net/WebLog/log-0061</a><br />
And<br />
<a href="http://mindview.net/WebLog/log-0064" rel="nofollow">http://mindview.net/WebLog/log-0064</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
