Specifications
Sun Services
Java™ Programming Language
Module 14, slide 12 of 22
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
A Simple Example
This program performs a copy file operation using a manual
buffer:
java TestNodeStreams file1 file2
1 import java.io.*;
2
3 public class TestNodeStreams {
4 public static void main(String[] args) {
5 try {
6 FileReader input = new FileReader(args[0]);
7 FileWriter output = new FileWriter(args[1]);
8 char[] buffer = new char[128];
9 int charsRead;
10
11 // read the first buffer
12 charsRead = input.read(buffer);










