Article View: borland.public.jbuilder.java.language
Article #16876what about IOExceptions
From: Marcel Hell
Date: Tue, 12 Jan 1999 00:00
Date: Tue, 12 Jan 1999 00:00
29 lines
1331 bytes
1331 bytes
Hi, I try to start a method which uses readByte.
The code of the method goes here:
public static void kodiere(String sourcefile, String destinationfile) throws
IOException {
DataInput sourcefile = new DataInputStream(new
FileInputStream(sourcefile));
DataOutput destination = new DataOutputStream(new
FileOutputStream(destinationfile));
try {
while(true){
byte b = (byte) source.readByte(); // Read a byte from the source
b = (byte) ((b+3)%256);
destination.writeByte(b);}}
catch (EOFException e) // End of the source file.
{System.out.println("All right! Coding finished.");
}
when I have a statement like this:
kodiere(sourcefile,destinationfile);
... I get an Error message "unreported Exception:java.io.IOException; must
be caught or declared to be thrown"
Now what is my mistake, what do I have to add??
Thanx for help
Marcel
Technical Details
Message-ID:
<77f85u$p8f9@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,c9d8c3f7cf0306c6,start X-Google-Attributes: gidf74b3,public From: "Marcel Hell" <MLP.HELL@student.unimaas.nl> Subject: what about IOExceptions Date: 1999/01/12 Message-ID: <77f85u$p8f9@forums.borland.com> X-Deja-AN: 431611847 Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language