SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
HDFS: read gzip content
Chris Lu4d9da157bc47
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.javaindex 48d942f881..9edbfb7997 100644--- a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java+++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java@@ -2,6 +2,7 @@ package seaweedfs.client;import org.apache.http.HttpEntity;import org.apache.http.HttpHeaders;+import org.apache.http.client.entity.GzipDecompressingEntity;import org.apache.http.client.methods.CloseableHttpResponse;import org.apache.http.client.methods.HttpGet;import org.apache.http.util.EntityUtils;@@ -78,7 +79,7 @@ public class SeaweedRead {HttpGet request = new HttpGet(String.format("http://%s/%s", locations.getLocations(0).getUrl(), chunkView.fileId));- request.setHeader(HttpHeaders.ACCEPT_ENCODING, "");+ request.setHeader(HttpHeaders.ACCEPT_ENCODING, "gzip");byte[] data = null;@@ -87,6 +88,18 @@ public class SeaweedRead {try {HttpEntity entity = response.getEntity();+ Header contentEncodingHeader = entity.getContentEncoding();++ if (contentEncodingHeader != null) {+ HeaderElement[] encodings =contentEncodingHeader.getElements();+ for (int i = 0; i < encodings.length; i++) {+ if (encodings[i].getName().equalsIgnoreCase("gzip")) {+ entity = new GzipDecompressingEntity(entity);+ break;+ }+ }+ }+data = EntityUtils.toByteArray(entity);EntityUtils.consume(entity);@@ -96,10 +109,6 @@ public class SeaweedRead {request.releaseConnection();}- if (chunkView.isCompressed) {- // data = Gzip.decompress(data);- }-if (chunkView.cipherKey != null && chunkView.cipherKey.length != 0) {try {data = SeaweedCipher.decrypt(data, chunkView.cipherKey);