All pastes #771706 Raw Edit

Untitled

public java v1 · immutable
·published 2007-11-13 04:09 UTC
rendered paste body
import java.io.*;import java.util.*;import javax.swing.JOptionPane;/*** Class: 'FileOp'*/public class FileOp {	/**	* Method: 'main'.	*/	public static void main(String[] args) throws IOException {		/*		* Variable Declarations	 	*/		String fileInName;		String fileOutName;		File fileIn;		File fileOut;		FileReader fr;		FileWriter fw;		BufferedReader br;		PrintWriter pw;		StringTokenizer st;		String a, str;		/*		* Initiate Variables		*/		fileIn = new File("file.in");		fileOut = new File("file.out");		fileInName = "file.in";		fileOutName = "file.out";		fr = new FileReader(fileInName);		fw = new FileWriter(fileOutName);		br = new BufferedReader(fr);		pw = new PrintWriter(fw);		a = br.readLine();		boolean fileCanRead = fileIn.canRead();		boolean fileCanWrite = fileOut.canWrite();		/*		* Start processing the 'in' stream ..		*/		try {			while((a = br.readLine()) != null) {				/* Print tokens	*/				st = new StringTokenizer(a);				while (st.hasMoreTokens()) {					str = st.nextToken();					System.out.println(str);					if (fileCanWrite) {						pw.println(str);					}				}			}		} finally {			/* Close both streams */			br.close();			pw.close();		}	}}