From ad36c7b0d76f870a5cb0c7c68f5c81ec5340a79e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 8 Feb 2021 02:28:45 -0800 Subject: refactoring: only expose FilerClient class --- .../main/java/com/seaweedfs/examples/ExampleReadFile.java | 6 +++--- .../main/java/com/seaweedfs/examples/ExampleWriteFile.java | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'other/java/examples/src') diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleReadFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleReadFile.java index bd73df802..d2eb94135 100644 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleReadFile.java +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleReadFile.java @@ -1,6 +1,6 @@ package com.seaweedfs.examples; -import seaweedfs.client.FilerGrpcClient; +import seaweedfs.client.FilerClient; import seaweedfs.client.SeaweedInputStream; import java.io.FileInputStream; @@ -13,7 +13,7 @@ public class ExampleReadFile { public static void main(String[] args) throws IOException { - FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888); + FilerClient filerClient = new FilerClient("localhost", 18888); long startTime = System.currentTimeMillis(); parseZip("/Users/chris/tmp/test.zip"); @@ -23,7 +23,7 @@ public class ExampleReadFile { long localProcessTime = startTime2 - startTime; SeaweedInputStream seaweedInputStream = new SeaweedInputStream( - filerGrpcClient, "/test.zip"); + filerClient, "/test.zip"); parseZip(seaweedInputStream); long swProcessTime = System.currentTimeMillis() - startTime2; diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWriteFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWriteFile.java index 228a3c0b7..26b74028f 100644 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWriteFile.java +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWriteFile.java @@ -1,6 +1,6 @@ package com.seaweedfs.examples; -import seaweedfs.client.FilerGrpcClient; +import seaweedfs.client.FilerClient; import seaweedfs.client.SeaweedInputStream; import seaweedfs.client.SeaweedOutputStream; @@ -13,15 +13,14 @@ public class ExampleWriteFile { public static void main(String[] args) throws IOException { - FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888); + FilerClient filerClient = new FilerClient("localhost", 18888); - SeaweedInputStream seaweedInputStream = new SeaweedInputStream( - filerGrpcClient, "/test.zip"); - unZipFiles(filerGrpcClient, seaweedInputStream); + SeaweedInputStream seaweedInputStream = new SeaweedInputStream(filerClient, "/test.zip"); + unZipFiles(filerClient, seaweedInputStream); } - public static void unZipFiles(FilerGrpcClient filerGrpcClient, InputStream is) throws IOException { + public static void unZipFiles(FilerClient filerClient, InputStream is) throws IOException { ZipInputStream zin = new ZipInputStream(is); ZipEntry ze; while ((ze = zin.getNextEntry()) != null) { @@ -34,7 +33,7 @@ public class ExampleWriteFile { continue; } - SeaweedOutputStream seaweedOutputStream = new SeaweedOutputStream(filerGrpcClient, "/test/"+filename); + SeaweedOutputStream seaweedOutputStream = new SeaweedOutputStream(filerClient, "/test/"+filename); byte[] bytesIn = new byte[16 * 1024]; int read = 0; while ((read = zin.read(bytesIn))!=-1) { -- cgit v1.2.3