Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Disk {
- private File outfile;
- private File infile;
- public PrintWriter out;
- public BufferedReader in;
- public Disk (String filename,String io){
- if(io.equals("out")){
- outfile = new File(filename);
- try{
- out = new PrintWriter(new FileWriter(outfile));
- }catch(Exception e1){
- System.out.println("Error in Constructor Call");
- }
- }
- if(io.equals("in")){
- infile = new File(filename);
- try{
- in = new BufferedReader(new FileReader(infile));
- }catch(FileNotFoundException e2) {
- System.out.println(filename + " not found");
- }
- }
- }
- public String readLine(){
- String line = null;
- try{
- line = in.readLine();
- }catch(java.io.IOException e){
- System.out.println("input line not valid");
- }
- return line;
- }
- }
Add Comment
Please, Sign In to add comment