【初心者】Java質問・相談スレ43【大歓迎】
■ このスレッドは過去ログ倉庫に格納されています
0079デフォルトの名無しさん
NGNGこの場合どうしたらいいんでしょうか
File file = null;FileOutputStream fos =null ;ZipOutputStream zos =null;
try {
file = new File("data.zip");fos = new FileOutputStream(file);zos = new ZipOutputStream(fos);
zos.putNextEntry(new ZipEntry("ファイル名.txt"));zos.write("中身".getBytes(), 0, 4);
zos.putNextEntry(new ZipEntry("filename.txt"));zos.write("contents".getBytes(), 0, 8);
}catch(Exception e){System.err.println(e);}
finally { try {zos.close();}catch(Exception e){} try {fos.close();}catch(Exception e){} }
■ このスレッドは過去ログ倉庫に格納されています