[java] 자바에서 압축 파일 내 특정 파일의 크기 가져오기
import java.io.*;
import java.util.zip.*;

public class ZipFileExample {
    public static void main(String[] args) {
        try (ZipFile zipFile = new ZipFile("example.zip")) {
            ZipEntry zipEntry = zipFile.getEntry("file.txt");
            if (zipEntry != null) {
                System.out.println("File size: " + zipEntry.getSize());
            } else {
                System.out.println("File not found in the zip");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

위 코드에서 example.zip은 압축 파일의 이름이고, file.txt는 크기를 가져올 파일의 이름입니다. ZipFile 클래스를 사용하여 Zip 파일을 열고, getEntry() 메서드로 특정 파일의 ZipEntry를 가져옵니다. 그 후, getSize() 메서드를 사용하여 파일의 크기를 얻을 수 있습니다.

참고 문헌: