【初心者】 Java質問・相談スレ26 【大歓迎】
■ このスレッドは過去ログ倉庫に格納されています
0662デフォルトの名無しさん
NGNGpublic static File copy(File from, File to){
if( !from.isFile() ){
throw new RuntimeException("specify copy target file path is not file: " + from);
}
try {
if( to.isDirectory() ){
to = new File(to, from.getName());
}
FileReader in = new FileReader(from);
FileWriter out = new FileWriter(to);
for(int c; (c = in.read()) != -1;) {
out.write(c);
}
in.close();
out.close();
return to;
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
を定義しなけりゃならんのですか。
何か使えるメソッドは無いですか。
■ このスレッドは過去ログ倉庫に格納されています