Specifications

Sun Services
Java™ Programming Language
Module 14, slide 13 of 22
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
A Simple Example
13
14 while ( charsRead != -1 ) {
15 // write the buffer out to the output file
16 output.write(buffer, 0, charsRead);
17
18 // read the next buffer
19 charsRead = input.read(buffer);
20 }
21
22 input.close();
23 output.close();
24 } catch (IOException e) {
25 e.printStackTrace();
26 }
27 }
28 }