Commits

Bjorn Bringert authored c1823701cc7
Handle EOF correctly in MemoryFile input stream. Before, the variants of MemoryFile.MemoryInputStream.read() would throw IOException or IndexOutOfBoundsException if EOF was encountered before the requested number of bytes was read. This violates the contract of InputStream.read(). This patch makes read() return the number of bytes available, if any. If already at EOF, -1 is returned. The patch also adds new tests, which checks cases where MemoryFile.MemoryInputStream.read() should throw IndexOutOfBoundsException or return -1. several of these tests failed with the old code and pass now. This fixes http://b/issue?id=1881894