Browse Source
fix bug : read error when position after 2147483647 (#3829)
Co-authored-by: huang.lin <hh@chaintool.ai>
pull/3833/head
livehl
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
3 deletions
-
other/java/client/src/main/java/seaweedfs/client/SeaweedInputStream.java
|
@ -119,9 +119,8 @@ public class SeaweedInputStream extends InputStream { |
|
|
|
|
|
|
|
|
long bytesRead = 0; |
|
|
long bytesRead = 0; |
|
|
int len = buf.remaining(); |
|
|
int len = buf.remaining(); |
|
|
int start = (int) this.position; |
|
|
|
|
|
if (start + len <= entry.getContent().size()) { |
|
|
|
|
|
entry.getContent().substring(start, start + len).copyTo(buf); |
|
|
|
|
|
|
|
|
if (this.position< Integer.MAX_VALUE && (this.position + len )<= entry.getContent().size()) { |
|
|
|
|
|
entry.getContent().substring((int)this.position, (int)(this.position + len)).copyTo(buf); |
|
|
} else { |
|
|
} else { |
|
|
bytesRead = SeaweedRead.read(this.filerClient, this.visibleIntervalList, this.position, buf, SeaweedRead.fileSize(entry)); |
|
|
bytesRead = SeaweedRead.read(this.filerClient, this.visibleIntervalList, this.position, buf, SeaweedRead.fileSize(entry)); |
|
|
} |
|
|
} |
|
|