Java: add SeaweedInputStream example

This commit is contained in:
Chris Lu
2021-02-04 18:44:57 -08:00
parent c3af72d950
commit 502554887f
2 changed files with 18 additions and 9 deletions

View File

@@ -1,8 +1,7 @@
package com.seaweedfs.examples;
import seaweed.hdfs.SeaweedHadoopInputStream;
import seaweedfs.client.FilerClient;
import seaweedfs.client.FilerGrpcClient;
import seaweedfs.client.SeaweedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
@@ -15,7 +14,6 @@ public class UnzipFile {
public static void main(String[] args) throws IOException {
FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888);
FilerClient filerClient = new FilerClient(filerGrpcClient);
long startTime = System.currentTimeMillis();
parseZip("/Users/chris/tmp/test.zip");
@@ -24,12 +22,8 @@ public class UnzipFile {
long localProcessTime = startTime2 - startTime;
SeaweedHadoopInputStream seaweedInputStream = new SeaweedHadoopInputStream(
filerGrpcClient,
new org.apache.hadoop.fs.FileSystem.Statistics(""),
"/",
filerClient.lookupEntry("/", "test.zip")
);
SeaweedInputStream seaweedInputStream = new SeaweedInputStream(
filerGrpcClient, "/", "test.zip");
parseZip(seaweedInputStream);
long swProcessTime = System.currentTimeMillis() - startTime2;