mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-21 02:54:26 +08:00
Java: add SeaweedInputStream example
This commit is contained in:
@@ -26,6 +26,21 @@ public class SeaweedInputStream extends InputStream {
|
||||
|
||||
private boolean closed = false;
|
||||
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user