blob: bfa582134de81d8e9568aecebcf6988c0e0d8d3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package io;
import java.util.*;
import java.io.*;
public class FileUtil {
public static Scanner openInFile(String filename){
Scanner localsc=null;
try
{
localsc=new Scanner (new FileInputStream(filename));
}catch(IOException ioe){
System.out.println(ioe.getMessage());
}
return localsc;
}
public static PrintStream openOutFile(String filename){
PrintStream localps=null;
try
{
localps=new PrintStream (new FileOutputStream(filename));
}catch(IOException ioe){
System.out.println(ioe.getMessage());
}
return localps;
}
public static FileInputStream openInputStream(String infilename){
FileInputStream fis=null;
try {
fis =(new FileInputStream(infilename));
} catch (IOException ioe) {
System.out.println(ioe.getMessage());
}
return fis;
}
}
|