logo       

curious about no flush with java.io.reader.transformChar: msg#00077

lang.groovy.user

Subject: curious about no flush with java.io.reader.transformChar

Greetings.

I'm coming to Groovy from other scripting languages (Perl, Python,
Ruby), so perhaps there's a good Java-ish answer to my question. I
searched the archives using Google and didn't find any discussion on
this topic.

I'm using groovy 1.0beta7 on Windows XP.

When I tried using transformChar for a null transformation:

testxform.groovy----------

import java.io.*
InputStreamReader queeg = new InputStreamReader ( System.in )
OutputStreamWriter zig = new OutputStreamWriter ( System.out )
queeg.transformChar( zig, {return it} )

--------------------------

C:>groovy testxform.groovy < testinput.txt > testoutput.txt

I expected transformChar to flush the Writer, but it doesn't. I get
exactly 0x9FFF characters written to testoutput.txt, unless I add

zig.flush()

to the end, in which case I get all of my expected output.

Basically, I expect all the methods that take closures to "clean up"
after themselves, which in this case I thought would include a flush.
Should transformChar flush the Writer, or is my expectation off base?

Thank you,

Alex



_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise