Skip to content

Commit 7ea31c8

Browse files
simplify FixedLengthBinRecReader via readFully call
1 parent bd268aa commit 7ea31c8

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

scala/src/main/scala/thunder/util/io/hadoop/FixedLengthBinaryRecordReader.scala

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,10 @@ class FixedLengthBinaryRecordReader extends RecordReader[LongWritable, BytesWrit
105105

106106
// setup a buffer to store the record
107107
val buffer = recordValue.getBytes
108+
fileInputStream.readFully(buffer)
108109

109-
breakable {
110-
var bytestoread: Int = recordLength
111-
while (bytestoread > 0) {
112-
val bytesread = fileInputStream.read(buffer, recordLength - bytestoread, bytestoread)
113-
if (bytesread == -1) {
114-
// EOF
115-
break()
116-
}
117-
// update our current position
118-
currentPosition += bytesread
119-
bytestoread -= bytesread
120-
}
121-
}
110+
// update our current position
111+
currentPosition += recordLength
122112

123113
// return true
124114
return true

0 commit comments

Comments
 (0)