zipÆÄÀÏ¿¡ ÀÖ´Â ÆÄÀÏ °Ë»öÇϱâ
ZipTest02.java
public class ZipTest02{
public static void main(String[] args){
try{
ZipFile zf = new ZipFile("ZipTest02.zip");
Enumeration entries = zf.entries();
String first = null;
while(entries.hasMoreElements()){
ZipEntry ze = (ZipEntry)entries.nextElement();
System.out.println("Entry " + ze.getName());
if(first == null){
first = ze.getName();
}
}
ZipEntry ze = zf.getEntry(first);
if(ze != null){
BufferedReader br = new BufferedReader(new InputStreamReader(zf.getInputStream(ze)));
long size = ze.getSize();
if(size > 0){
System.out.println(first + " Length is " + size);
String line;
while((line = br.readLine()) != null){
System.out.println(line);
}
br.close();
}
}
}catch(IOException e){
e.printStackTrace();
}
}
}
C:\util>javac ZipTest02.java
C:\util>java ZipTest02
Entry 01.txt
Entry 02.txt
Entry 03.txt
01.txt Length is 21
http://www.jabook.org
ÁöÁ¤µÈ ÆÄÀϾȿ¡ ÀÖ´Â ÆÄÀϸíÀ» º¸¿©ÁÖ°í °¡Àå óÀ½¿¡ º¸¿©Áø ÆÄÀÏ¿¡ ´ã±ä ¹®ÀÚ¿ÀÇ Å©±â¿Í ³»¿ë¸¦ µµ½ºÃ¢¿¡ Ãâ·ÂÇØÁÝ´Ï´Ù.
jabookÀúÀÚ¸íÇÔ |
Á¦¸ñ:¼Ò¼³°°Àº¹Ì´ÏÄÚµå ÀÛ¼ºÀÚ:Àںϸâ¹ö ±è¿Ï±â |