|
@ -19,9 +19,9 @@ public class SeaweedInputStream extends InputStream { |
|
|
|
|
|
|
|
|
private final FilerClient filerClient; |
|
|
private final FilerClient filerClient; |
|
|
private final String path; |
|
|
private final String path; |
|
|
private final FilerProto.Entry entry; |
|
|
|
|
|
private final List<SeaweedRead.VisibleInterval> visibleIntervalList; |
|
|
private final List<SeaweedRead.VisibleInterval> visibleIntervalList; |
|
|
private final long contentLength; |
|
|
private final long contentLength; |
|
|
|
|
|
private FilerProto.Entry entry; |
|
|
|
|
|
|
|
|
private long position = 0; // cursor of the file |
|
|
private long position = 0; // cursor of the file |
|
|
|
|
|
|
|
@ -39,6 +39,10 @@ public class SeaweedInputStream extends InputStream { |
|
|
throw new FileNotFoundException(); |
|
|
throw new FileNotFoundException(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (RemoteUtil.isInRemoteOnly(entry)) { |
|
|
|
|
|
entry = RemoteUtil.downloadRemoteEntry(filerClient, fullpath, entry); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.contentLength = SeaweedRead.fileSize(entry); |
|
|
this.contentLength = SeaweedRead.fileSize(entry); |
|
|
|
|
|
|
|
|
this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(filerClient, entry.getChunksList()); |
|
|
this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(filerClient, entry.getChunksList()); |
|
@ -54,6 +58,11 @@ public class SeaweedInputStream extends InputStream { |
|
|
this.filerClient = filerClient; |
|
|
this.filerClient = filerClient; |
|
|
this.path = path; |
|
|
this.path = path; |
|
|
this.entry = entry; |
|
|
this.entry = entry; |
|
|
|
|
|
|
|
|
|
|
|
if (RemoteUtil.isInRemoteOnly(entry)) { |
|
|
|
|
|
this.entry = RemoteUtil.downloadRemoteEntry(filerClient, path, entry); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.contentLength = SeaweedRead.fileSize(entry); |
|
|
this.contentLength = SeaweedRead.fileSize(entry); |
|
|
|
|
|
|
|
|
this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(filerClient, entry.getChunksList()); |
|
|
this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(filerClient, entry.getChunksList()); |
|
|