package server.servlets;
import java.io.*;
import java.util.Properties;
public class FileUtil {
private FileUtil() {
}
public static File getFile(String f) {
return new File(f);
}
public static Properties loadProperties(String f)
throws PropFileException {
Properties prop = new Properties();
try {
FileInputStream fs = getFileInputStream(f);
prop.load(fs);
fs.close();
} catch (FileNotFoundException pfnf) {
throw new PropFileException();
} catch (IOException io) {
throw new PropFileException();
}
return prop;
}
public static FileInputStream getFileInputStream(String f)
throws FileNotFoundException, IOException {
return new FileInputStream(f);
}
public static BufferedReader openInputFile(File f)
throws FileNotFoundException, IOException {
return (new BufferedReader(new FileReader(f)));
}
public static BufferedWriter openOutputFile(File f)
throws FileNotFoundException, IOException {
return (new BufferedWriter(new FileWriter(f)));
}
public static void close(BufferedReader br) {
try {
br.close();
} catch (IOException io) {
}
}
public static void close(BufferedWriter bw) {
try {
bw.close();
} catch (IOException io) {
}
}
public static void println(BufferedWriter bw, Object o) {
try {
bw.write(o + "\n");
} catch (IOException io) {
}
}
}