25 lines
642 B
Java
25 lines
642 B
Java
package com.dbgen;
|
|
|
|
import java.io.*;
|
|
|
|
public final class FileOperation {
|
|
private static File toFile(File base, String name) {
|
|
File file = new File(base, name);
|
|
file.getParentFile().mkdirs();
|
|
if (!file.getParentFile().exists())
|
|
throw new RuntimeException("can not create dirs: " + file.getParent());
|
|
return file;
|
|
}
|
|
public static PrintStream fopen(File path, String name) {
|
|
try {
|
|
return new PrintStream(new CachedFileOutputStream(toFile(path, name)), false);
|
|
} catch (IOException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
public static PrintStream fopen(String name) {
|
|
return fopen(LdbMain.outputPath, name);
|
|
}
|
|
}
|