I think the idea is to treat an IOException thrown by any but the first invocation of readBytes() as equivalent to end-of-file such as described for InputStream::read(byte[],int,int)<https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/io/InputStream.html#read(byte%5B%5D,int,int)> with respect to its invocation of InputStream::read()<https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/io/InputStream.html#read()>.
On Jul 24, 2023, at 8:33 AM, Bernd <e...@zusammenkunft.net<mailto:e...@zusammenkunft.net>> wrote: If you return the short buffer (on IOException), does it need to cache the pending exception or can you just rely on the next read hitting that underlying exception again? (Is there an actual guarantee somewhere that the read position is not altered on IOExceptions or that you always get lending bytes before this report? (If so, does the native code do that as well?)