Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue in BGZFSplitGuesser relating to incomplete copy. #149

Merged
merged 1 commit into from
Aug 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/main/java/org/seqdoop/hadoop_bam/util/BGZFSplitGuesser.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ public long guessNextBGZFBlockStart(long beg, long end)
byte[] arr = new byte[2*0xffff - 1];

this.seekableInFile.seek(beg);
int read = inFile.read(arr, 0, Math.min((int) (end - beg),
arr.length));
if (read == -1) {
return -1; // EOF
int totalRead = 0;
for (int left = Math.min((int)(end - beg), arr.length); left > 0;) {
final int r = inFile.read(arr, totalRead, left);
if (r < 0)
break;
totalRead += r;
left -= r;
}
arr = Arrays.copyOf(arr, read);
arr = Arrays.copyOf(arr, totalRead);

this.in = new ByteArraySeekableStream(arr);

Expand Down