GZIPOutputStream
으로 파일을 업로드하기 전에 Java에서 파일을 압축하려고합니다. 업로드를 위해 gzipped 파일을 메모리에 저장하고 로컬 컴퓨터에서 gzipped 파일을 생성하지 않는 방법이 있습니까?GZIPOutputStream으로 압축하여 gzip 파일을 로컬로 생성하지 않고 업로드합니다.
감사합니다. GzipCompressingEntity
HttpPost httpPost = new HttpPost("https://host/stuff");
httpPost.setEntity(new GzipCompressingEntity(new FileEntity(new File("my.stuff"))));
CloseableHttpResponse response = httpclient.execute(httpPost);
try {
EntityUtils.consume(response.getEntity());
} finally {
response.close();
}
바이트 배열로 저장할 수 있습니다. –