Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Normal
Description
The first line of BufferedRandomAccessFile.readAtMost is
if (length >= bufferEnd && hitEOF)
I think It should be ">" instead of ">=",
Here is a test for this:
@Test public void testRead() throws IOException { File tmpFile = File.createTempFile("readtest", "bin"); tmpFile.deleteOnExit(); // Create the BRAF by filename instead of by file. BufferedRandomAccessFile rw = new BufferedRandomAccessFile(tmpFile.getPath(), "rw"); rw.write(new byte[] {1}); rw.seek(0); byte[] buffer = new byte[1]; assert rw.read(buffer) == 1; assert buffer[0] == 1; }