JDK-4529325 - Java Issue Tracker
Nov 19, 2001 ... ... input stream of the InflaterOutputStream. This byte will lead to an error on the consequent iteration. Replacing in the submitter's example ...
Nov 19, 2001 ... ... input stream of the InflaterOutputStream. This byte will lead to an error on the consequent iteration. Replacing in the submitter's example ...
Because I don't know what type of InputStream that can be passed in, I can't use any of the provided DataSource implementation classes (e.g. java.activation.FileDataSource).java.io.IOException: read error. at java.lang.Throwable.<init>(Compiled Code).
The looping code is actually in the InputStreamReader.fill() method.But the stream returned by CommPort.getInputStream() simply returns zero, without throwing an exception. The documentation for InputStream.read(byte[]) doesn't indicate that zero is an invalid value, though.
When the skip(long) method is used from any position in the stream with a skip value that is larger than the available bytes in the stream, the skip method skips beyond EOF and returns the same value that was given to it. See code below.
I have now isolated the problem into a single piece of code for demonstration purposes. This is cut down from a larger piece of software which uses the Java Activation Framework (hence the use of InputStreams). I have attached the code, and two trivial HTML documents.