Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ private boolean refill() throws IOException {
while (nRead == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the comment says it checks the weather :-).

nRead = fileChannel.read(byteBuffer);
}
byteBuffer.flip();
if (nRead < 0) {
return false;
}
byteBuffer.flip();
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ public void setUp() throws IOException {
}

@After
public void tearDown() {
public void tearDown() throws IOException {
inputFile.delete();

for (InputStream is : inputStreams) {
is.close();
}
}

@Test
Expand Down Expand Up @@ -141,4 +145,15 @@ public void testBytesSkippedAfterEOF() throws IOException {
assertEquals(-1, inputStream.read());
}
}

@Test
public void testReadPastEOF() throws IOException {
InputStream is = inputStreams[0];
byte[] buf = new byte[1024];
int read;
while ((read = is.read(buf, 0, buf.length)) != -1);

int readAfterEOF = is.read(buf, 0, buf.length);
assertEquals(-1, readAfterEOF);
}
}