no write(String s) in BufferedWriter?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

no write(String s) in BufferedWriter?

Mike Cowlishaw-2
Buffered writer has (<sigh>) a method  write(int), so NetRexx is trying to
convert your string to an int (integer).

Mike Cowlishaw, IBM Fellow, IBM UK Laboratories
mailto:[hidden email]   [http://www2.hursley.ibm.com]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: no write(String s) in BufferedWriter?

Aviatrexx
** Reply to note from Mike Cowlishaw <[hidden email]> Fri, 13 Feb 1998 09:09:50 +0000
>  
> Buffered writer has (<sigh>) a method  write(int), so NetRexx is trying to
> convert your string to an int (integer).

..and it sure is (ahem) single-minded about it, too.  I've tried
every way I can think of, to cast/convert/coerce/construct 'line'
into a Java-approved String (even the crossref agrees), but I get the
same error message.

-Chip-  Member of Rexx Language Association & TeamOS/2 & Thoroughly Warped!
Aresti Systems  POB 13306  Research Triangle Pk NC 27709-3306  919.303.3306
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: no write(String s) in BufferedWriter?

Mike Cowlishaw-2
In reply to this post by Mike Cowlishaw-2
The upwards search for a method is halted as soon as a match is found -- hence
the Writer class (which is the superclass of BufferedWriter, and contains the
write(String) method isn't even inspected.  Hence what you want to
do is to cast the output stream to the Writer class, so the search starts
there.   That is, instead of:

  out.write(line)

you could write:

  (Writer out).write(line)

I think it's probably clearer (and it would run slightly faster) to use:

  out.write(line, 0, line.length)

Mike Cowlishaw, IBM Fellow, IBM UK Laboratories
mailto:[hidden email]   [http://www2.hursley.ibm.com]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>