import org.apache.commons.compress.archivers.zip.*
import org.apache.commons.compress.utils.*
is = new BufferedInputStream(new FileInputStream("test.zip"))
zais = new ZipArchiveInputStream(is, "Windows-31J", true)
dest = ".\\out\\"
while((ent = zais.getNextZipEntry()) != null){
println dest + ent.getName()
df = new File(dest + ent.getName())
if( ent.isDirectory() ){
df.mkdirs()
} else {
if( df.getParentFile().exists() == false ){
df.getParentFile().mkdirs()
}
OutputStream out = new FileOutputStream(df)
IOUtils.copy(zais, out, 8192)
out.close()
}
}
zais.close()
is.close()
動作環境
groovy 1.7.4, JDK6 Update21, Apache Commons Compress 1.1
0 件のコメント:
コメントを投稿