0
코드에 문제가없는 것은 아니지만 대상 위치에서 압축 파일의 크기를 확인할 때마다 파일 크기가 2 또는 3KB로만 줄어든 것을 볼 수 있습니다. 대용량 파일은 약 650MB로 확장됩니다.DeflaterOutputStream을 사용하여 큰 파일을 압축하는 방법은 무엇입니까?
public static void main(String[] args) throws Exception
{
FileInputStream fin = new FileInputStream("filetobecompressed.mp4");
FileOutputStream fout = new FileOutputStream("compressedfile.mp4");
DeflaterOutputStream dout = new DeflaterOutputStream(fout);
byte b[] = new byte[8192];
int r;
float tracker = 0;
while((r=fin.read(b))!=-1)
{
dout.write(b,0,r);
dout.flush();
tracker += (float)r/1000000f;
System.out.println(tracker + "MB compressed");
}
dout.finish();
fin.close();
fout.close();
dout.close();
System.out.println("Compression successful");
}
미리 감사드립니다.
BTW 'flush()'를 호출 할 때마다 압축 파일과 함께 약간의 데이터를 추가합니다. 그것은 그 시점에서 작업하고있는 결론을 가져옵니다. –