Personal tools
You are here: Home Classes Fall 2004 - Spring 2005 CS 150 4.20.05 April 20
Document Actions

April 20

by admin last modified 2005-05-11 13:34

Examples from April 20

Today we talked about java's classes for working with text files.

TextFileBuilder.java and SimpleInput.java This uses the FileWriter class to create a file. Lines of text are read from the keyboard with SimpleInput and written to the file.

TextFilePrinter.java This opens a text file and prints its contents usingthe FileReader class.

BetterReader.java This isn't really a better reader, but it uses the FileReader class to read through a text file one line at a time.

Copy.java and SimpleInput.java Class SimpleInput is used to get the names of a source file and a destination file. The buffered read and buffered write abilities of FileReader and FileWriter are used to copy the source into the destination with just two instructions and no loops.

 

 

 

 

 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: