aboutsummaryrefslogtreecommitdiff
path: root/other/java/client
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-04 18:44:57 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-04 18:44:57 -0800
commit502554887f58915c077462372db4e2813eac3f92 (patch)
treec3762605197b89ea25ab35f858397cbca3ab4f39 /other/java/client
parentc3af72d950d93bfa0d42f9e2bf68d183c6285d73 (diff)
downloadseaweedfs-502554887f58915c077462372db4e2813eac3f92.tar.xz
seaweedfs-502554887f58915c077462372db4e2813eac3f92.zip
Java: add SeaweedInputStream example
Diffstat (limited to 'other/java/client')
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java
index 312e77aa2..519ff0fd9 100644
--- a/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java
+++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java
@@ -28,6 +28,21 @@ public class SeaweedInputStream extends InputStream {
public SeaweedInputStream(
final FilerGrpcClient filerGrpcClient,
+ final String dir, final String name) throws IOException {
+ this.filerGrpcClient = filerGrpcClient;
+ this.path = dir;
+ FilerClient filerClient = new FilerClient(filerGrpcClient);
+ this.entry = filerClient.lookupEntry(dir, name);
+ this.contentLength = SeaweedRead.fileSize(entry);
+
+ this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(filerGrpcClient, entry.getChunksList());
+
+ LOG.debug("new path:{} entry:{} visibleIntervalList:{}", path, entry, visibleIntervalList);
+
+ }
+
+ public SeaweedInputStream(
+ final FilerGrpcClient filerGrpcClient,
final String path,
final FilerProto.Entry entry) throws IOException {
this.filerGrpcClient = filerGrpcClient;