From 6f4aab51f9d7e8d9721c3c4fd7b57da7ab8b6d8e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 30 Jan 2021 06:16:02 -0800 Subject: refactoring SeaweedInputStream --- .../java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'other/java/examples/src') diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java index 0529a5c73..317327be4 100644 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java @@ -1,6 +1,6 @@ package com.seaweedfs.examples; -import seaweed.hdfs.SeaweedInputStream; +import seaweed.hdfs.SeaweedHadoopInputStream; import seaweedfs.client.FilerClient; import seaweedfs.client.FilerGrpcClient; @@ -24,7 +24,7 @@ public class UnzipFile { long localProcessTime = startTime2 - startTime; - SeaweedInputStream seaweedInputStream = new SeaweedInputStream( + SeaweedHadoopInputStream seaweedInputStream = new SeaweedHadoopInputStream( filerGrpcClient, new org.apache.hadoop.fs.FileSystem.Statistics(""), "/", -- cgit v1.2.3 From 502554887f58915c077462372db4e2813eac3f92 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 4 Feb 2021 18:44:57 -0800 Subject: Java: add SeaweedInputStream example --- .../src/main/java/com/seaweedfs/examples/UnzipFile.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'other/java/examples/src') diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java index 317327be4..fad1471b6 100644 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java @@ -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; -- cgit v1.2.3 From 7f90d14f100f9ce69b6b05f6b8f80823f4c69fdf Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 4 Feb 2021 20:16:08 -0800 Subject: Java: add SeaweedOutputStream example --- .../java/com/seaweedfs/examples/UnzipFile.java | 2 +- .../java/com/seaweedfs/examples/WriteFile.java | 48 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java (limited to 'other/java/examples/src') diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java index fad1471b6..12eab1a2c 100644 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java @@ -23,7 +23,7 @@ public class UnzipFile { long localProcessTime = startTime2 - startTime; SeaweedInputStream seaweedInputStream = new SeaweedInputStream( - filerGrpcClient, "/", "test.zip"); + filerGrpcClient, "/test.zip"); parseZip(seaweedInputStream); long swProcessTime = System.currentTimeMillis() - startTime2; diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java new file mode 100644 index 000000000..b0bd54997 --- /dev/null +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java @@ -0,0 +1,48 @@ +package com.seaweedfs.examples; + +import seaweedfs.client.FilerGrpcClient; +import seaweedfs.client.SeaweedInputStream; +import seaweedfs.client.SeaweedOutputStream; + +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class WriteFile { + + public static void main(String[] args) throws IOException { + + FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888); + + SeaweedInputStream seaweedInputStream = new SeaweedInputStream( + filerGrpcClient, "/test.zip"); + unZipFiles(filerGrpcClient, seaweedInputStream); + + } + + public static void unZipFiles(FilerGrpcClient filerGrpcClient, InputStream is) throws IOException { + ZipInputStream zin = new ZipInputStream(is); + ZipEntry ze; + while ((ze = zin.getNextEntry()) != null) { + + String filename = ze.getName(); + if (filename.indexOf("/") >= 0) { + filename = filename.substring(filename.lastIndexOf("/") + 1); + } + if (filename.length()==0) { + continue; + } + + SeaweedOutputStream seaweedOutputStream = new SeaweedOutputStream(filerGrpcClient, "/test/"+filename); + byte[] bytesIn = new byte[16 * 1024]; + int read = 0; + while ((read = zin.read(bytesIn))!=-1) { + seaweedOutputStream.write(bytesIn,0,read); + } + seaweedOutputStream.close(); + + System.out.println(ze.getName()); + } + } +} -- cgit v1.2.3 From 42e5ef4b0150d339befedb06f6ed23a6c9890296 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 4 Feb 2021 21:02:54 -0800 Subject: Java: adjust examples --- .../com/seaweedfs/examples/ExampleReadFile.java | 48 ++++++++++++++++++++++ .../examples/ExampleWatchFileChanges.java | 46 +++++++++++++++++++++ .../com/seaweedfs/examples/ExampleWriteFile.java | 48 ++++++++++++++++++++++ .../java/com/seaweedfs/examples/UnzipFile.java | 48 ---------------------- .../java/com/seaweedfs/examples/WatchFiles.java | 46 --------------------- .../java/com/seaweedfs/examples/WriteFile.java | 48 ---------------------- 6 files changed, 142 insertions(+), 142 deletions(-) create mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/ExampleReadFile.java create mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWatchFileChanges.java create mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWriteFile.java delete mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java delete mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/WatchFiles.java delete mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java (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 new file mode 100644 index 000000000..bd73df802 --- /dev/null +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleReadFile.java @@ -0,0 +1,48 @@ +package com.seaweedfs.examples; + +import seaweedfs.client.FilerGrpcClient; +import seaweedfs.client.SeaweedInputStream; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class ExampleReadFile { + + public static void main(String[] args) throws IOException { + + FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888); + + long startTime = System.currentTimeMillis(); + parseZip("/Users/chris/tmp/test.zip"); + + long startTime2 = System.currentTimeMillis(); + + long localProcessTime = startTime2 - startTime; + + SeaweedInputStream seaweedInputStream = new SeaweedInputStream( + filerGrpcClient, "/test.zip"); + parseZip(seaweedInputStream); + + long swProcessTime = System.currentTimeMillis() - startTime2; + + System.out.println("Local time: " + localProcessTime); + System.out.println("SeaweedFS time: " + swProcessTime); + + } + + public static void parseZip(String filename) throws IOException { + FileInputStream fileInputStream = new FileInputStream(filename); + parseZip(fileInputStream); + } + + public static void parseZip(InputStream is) throws IOException { + ZipInputStream zin = new ZipInputStream(is); + ZipEntry ze; + while ((ze = zin.getNextEntry()) != null) { + System.out.println(ze.getName()); + } + } +} diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWatchFileChanges.java b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWatchFileChanges.java new file mode 100644 index 000000000..72c572d31 --- /dev/null +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWatchFileChanges.java @@ -0,0 +1,46 @@ +package com.seaweedfs.examples; + +import seaweedfs.client.FilerClient; +import seaweedfs.client.FilerProto; + +import java.io.IOException; +import java.util.Date; +import java.util.Iterator; + +public class ExampleWatchFileChanges { + + public static void main(String[] args) throws IOException { + + FilerClient filerClient = new FilerClient("localhost", 18888); + + long sinceNs = (System.currentTimeMillis() - 3600 * 1000) * 1000000L; + + Iterator watch = filerClient.watch( + "/buckets", + "exampleClientName", + sinceNs + ); + + System.out.println("Connected to filer, subscribing from " + new Date()); + + while (watch.hasNext()) { + FilerProto.SubscribeMetadataResponse event = watch.next(); + FilerProto.EventNotification notification = event.getEventNotification(); + if (!event.getDirectory().equals(notification.getNewParentPath())) { + // move an entry to a new directory, possibly with a new name + if (notification.hasOldEntry() && notification.hasNewEntry()) { + System.out.println("moved " + event.getDirectory() + "/" + notification.getOldEntry().getName() + " to " + notification.getNewParentPath() + "/" + notification.getNewEntry().getName()); + } else { + System.out.println("this should not happen."); + } + } else if (notification.hasNewEntry() && !notification.hasOldEntry()) { + System.out.println("created entry " + event.getDirectory() + "/" + notification.getNewEntry().getName()); + } else if (!notification.hasNewEntry() && notification.hasOldEntry()) { + System.out.println("deleted entry " + event.getDirectory() + "/" + notification.getOldEntry().getName()); + } else if (notification.hasNewEntry() && notification.hasOldEntry()) { + System.out.println("updated entry " + event.getDirectory() + "/" + notification.getNewEntry().getName()); + } + } + + } +} 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 new file mode 100644 index 000000000..228a3c0b7 --- /dev/null +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/ExampleWriteFile.java @@ -0,0 +1,48 @@ +package com.seaweedfs.examples; + +import seaweedfs.client.FilerGrpcClient; +import seaweedfs.client.SeaweedInputStream; +import seaweedfs.client.SeaweedOutputStream; + +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class ExampleWriteFile { + + public static void main(String[] args) throws IOException { + + FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888); + + SeaweedInputStream seaweedInputStream = new SeaweedInputStream( + filerGrpcClient, "/test.zip"); + unZipFiles(filerGrpcClient, seaweedInputStream); + + } + + public static void unZipFiles(FilerGrpcClient filerGrpcClient, InputStream is) throws IOException { + ZipInputStream zin = new ZipInputStream(is); + ZipEntry ze; + while ((ze = zin.getNextEntry()) != null) { + + String filename = ze.getName(); + if (filename.indexOf("/") >= 0) { + filename = filename.substring(filename.lastIndexOf("/") + 1); + } + if (filename.length()==0) { + continue; + } + + SeaweedOutputStream seaweedOutputStream = new SeaweedOutputStream(filerGrpcClient, "/test/"+filename); + byte[] bytesIn = new byte[16 * 1024]; + int read = 0; + while ((read = zin.read(bytesIn))!=-1) { + seaweedOutputStream.write(bytesIn,0,read); + } + seaweedOutputStream.close(); + + System.out.println(ze.getName()); + } + } +} diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java deleted file mode 100644 index 12eab1a2c..000000000 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/UnzipFile.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.seaweedfs.examples; - -import seaweedfs.client.FilerGrpcClient; -import seaweedfs.client.SeaweedInputStream; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -public class UnzipFile { - - public static void main(String[] args) throws IOException { - - FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888); - - long startTime = System.currentTimeMillis(); - parseZip("/Users/chris/tmp/test.zip"); - - long startTime2 = System.currentTimeMillis(); - - long localProcessTime = startTime2 - startTime; - - SeaweedInputStream seaweedInputStream = new SeaweedInputStream( - filerGrpcClient, "/test.zip"); - parseZip(seaweedInputStream); - - long swProcessTime = System.currentTimeMillis() - startTime2; - - System.out.println("Local time: " + localProcessTime); - System.out.println("SeaweedFS time: " + swProcessTime); - - } - - public static void parseZip(String filename) throws IOException { - FileInputStream fileInputStream = new FileInputStream(filename); - parseZip(fileInputStream); - } - - public static void parseZip(InputStream is) throws IOException { - ZipInputStream zin = new ZipInputStream(is); - ZipEntry ze; - while ((ze = zin.getNextEntry()) != null) { - System.out.println(ze.getName()); - } - } -} diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/WatchFiles.java b/other/java/examples/src/main/java/com/seaweedfs/examples/WatchFiles.java deleted file mode 100644 index e489cb3b1..000000000 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/WatchFiles.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.seaweedfs.examples; - -import seaweedfs.client.FilerClient; -import seaweedfs.client.FilerProto; - -import java.io.IOException; -import java.util.Date; -import java.util.Iterator; - -public class WatchFiles { - - public static void main(String[] args) throws IOException { - - FilerClient filerClient = new FilerClient("localhost", 18888); - - long sinceNs = (System.currentTimeMillis() - 3600 * 1000) * 1000000L; - - Iterator watch = filerClient.watch( - "/buckets", - "exampleClientName", - sinceNs - ); - - System.out.println("Connected to filer, subscribing from " + new Date()); - - while (watch.hasNext()) { - FilerProto.SubscribeMetadataResponse event = watch.next(); - FilerProto.EventNotification notification = event.getEventNotification(); - if (!event.getDirectory().equals(notification.getNewParentPath())) { - // move an entry to a new directory, possibly with a new name - if (notification.hasOldEntry() && notification.hasNewEntry()) { - System.out.println("moved " + event.getDirectory() + "/" + notification.getOldEntry().getName() + " to " + notification.getNewParentPath() + "/" + notification.getNewEntry().getName()); - } else { - System.out.println("this should not happen."); - } - } else if (notification.hasNewEntry() && !notification.hasOldEntry()) { - System.out.println("created entry " + event.getDirectory() + "/" + notification.getNewEntry().getName()); - } else if (!notification.hasNewEntry() && notification.hasOldEntry()) { - System.out.println("deleted entry " + event.getDirectory() + "/" + notification.getOldEntry().getName()); - } else if (notification.hasNewEntry() && notification.hasOldEntry()) { - System.out.println("updated entry " + event.getDirectory() + "/" + notification.getNewEntry().getName()); - } - } - - } -} diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java deleted file mode 100644 index b0bd54997..000000000 --- a/other/java/examples/src/main/java/com/seaweedfs/examples/WriteFile.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.seaweedfs.examples; - -import seaweedfs.client.FilerGrpcClient; -import seaweedfs.client.SeaweedInputStream; -import seaweedfs.client.SeaweedOutputStream; - -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -public class WriteFile { - - public static void main(String[] args) throws IOException { - - FilerGrpcClient filerGrpcClient = new FilerGrpcClient("localhost", 18888); - - SeaweedInputStream seaweedInputStream = new SeaweedInputStream( - filerGrpcClient, "/test.zip"); - unZipFiles(filerGrpcClient, seaweedInputStream); - - } - - public static void unZipFiles(FilerGrpcClient filerGrpcClient, InputStream is) throws IOException { - ZipInputStream zin = new ZipInputStream(is); - ZipEntry ze; - while ((ze = zin.getNextEntry()) != null) { - - String filename = ze.getName(); - if (filename.indexOf("/") >= 0) { - filename = filename.substring(filename.lastIndexOf("/") + 1); - } - if (filename.length()==0) { - continue; - } - - SeaweedOutputStream seaweedOutputStream = new SeaweedOutputStream(filerGrpcClient, "/test/"+filename); - byte[] bytesIn = new byte[16 * 1024]; - int read = 0; - while ((read = zin.read(bytesIn))!=-1) { - seaweedOutputStream.write(bytesIn,0,read); - } - seaweedOutputStream.close(); - - System.out.println(ze.getName()); - } - } -} -- cgit v1.2.3 From 8c3177d835bb86eed6127b390e2f39ca63ba1a04 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 4 Feb 2021 21:41:19 -0800 Subject: java: resolve parent directory if started with seaweedfs:// --- .../java/com/seaweedfs/examples/HdfsCopyFile.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 other/java/examples/src/main/java/com/seaweedfs/examples/HdfsCopyFile.java (limited to 'other/java/examples/src') diff --git a/other/java/examples/src/main/java/com/seaweedfs/examples/HdfsCopyFile.java b/other/java/examples/src/main/java/com/seaweedfs/examples/HdfsCopyFile.java new file mode 100644 index 000000000..006c581c9 --- /dev/null +++ b/other/java/examples/src/main/java/com/seaweedfs/examples/HdfsCopyFile.java @@ -0,0 +1,25 @@ +package com.seaweedfs.examples; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.io.IOUtils; + +import java.io.*; + +public class HdfsCopyFile { + public static void main(String[] args) throws IOException { + Configuration configuration = new Configuration(); + + configuration.set("fs.defaultFS", "seaweedfs://localhost:8888"); + configuration.set("fs.seaweedfs.impl", "seaweed.hdfs.SeaweedFileSystem"); + + FileSystem fs = FileSystem.get(configuration); + String source = "/Users/chris/tmp/test.zip"; + String destination = "/buckets/spark/test01.zip"; + InputStream in = new BufferedInputStream(new FileInputStream(source)); + + OutputStream out = fs.create(new Path(destination)); + IOUtils.copyBytes(in, out, 4096, true); + } +} -- cgit v1.2.3 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