no write(String s) in BufferedWriter?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

no write(String s) in BufferedWriter?

Aviatrexx
I'm afraid I don't understand what's going on here.  The following
code snippet compiles, runs, and produces the single line file
expected.

filetst.nrx:
  output = BufferedWriter(FileWriter(File('filetst.out')))
  line='Line of text'
  output.write(line,0,12)
--output.write(line)
  output.close()

Removing the dashes, however, produces the following error:

[N:\nrx\jnrw\7_fileio]nrc -run filetst
NetRexx portable processor, version 1.113
Copyright (c) IBM Corporation, 1997.  All rights reserved.
Program filetst.nrx
Compilation of 'filetst.nrx' successful
Running filetst ...
java.lang.NumberFormatException: Line 2
        at netrexx.lang.Rexx.toint(Compiled Code)
        at filetst.main(Compiled Code)

[N:\nrx\jnrw\7_fileio]

According to my JiaN, BufferedWriter doesn't have a 'write(String s)'
method, but its immediate superclass Writer, which is abstract, has a
  public void write(String str) throws IOException
instance method.  Since BufferedWriter doesn't override that method,
I assumed that I would be able to use it, but apparently not.  Laura
Lemay, in TYJava1.1in24Days seems to think I should, too.

What don't we understand, here?

-Chip Davis-      Aresti Systems   Member of: Rexx Language Association
[hidden email]   P.O.Box 13306               ANSI Rexx Standard Committee
919.303.3306      RTP NC 27709-3306           JavaLobby & Thoroughly Warped!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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>