Skip to content

Commit

Permalink
simplify FixedLengthBinRecReader via readFully call
Browse files Browse the repository at this point in the history
  • Loading branch information
industrial-sloth committed Nov 4, 2014
1 parent bd268aa commit 7ea31c8
Showing 1 changed file with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,10 @@ class FixedLengthBinaryRecordReader extends RecordReader[LongWritable, BytesWrit

// setup a buffer to store the record
val buffer = recordValue.getBytes
fileInputStream.readFully(buffer)

breakable {
var bytestoread: Int = recordLength
while (bytestoread > 0) {
val bytesread = fileInputStream.read(buffer, recordLength - bytestoread, bytestoread)
if (bytesread == -1) {
// EOF
break()
}
// update our current position
currentPosition += bytesread
bytestoread -= bytesread
}
}
// update our current position
currentPosition += recordLength

// return true
return true
Expand Down

0 comments on commit 7ea31c8

Please sign in to comment.