-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b23
As per spec - https://download.java.net/java/early_access/jdk19/docs/api/java.base/java/io/InputStream.html#read(byte%5B%5D,int,int)
"If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b."
One case which looks ambiguous is -
Case - when stream is at the end of file and the length is zero, what is the expected value is it 0 or -1?
Observation is - ObjectInputStream is returning 0 at EOF when length is zero, SequenceInputStream returns -1 at EOF when length is zero.
Can you please clarify what is the expected behavior in this case? Is there any scope for spec improvements here?
"If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b."
One case which looks ambiguous is -
Case - when stream is at the end of file and the length is zero, what is the expected value is it 0 or -1?
Observation is - ObjectInputStream is returning 0 at EOF when length is zero, SequenceInputStream returns -1 at EOF when length is zero.
Can you please clarify what is the expected behavior in this case? Is there any scope for spec improvements here?
- csr for
-
JDK-8286675 SequenceInputStream::read(b, off, 0) returns -1 at EOF
-
- Closed
-
- relates to
-
JDK-8284022 java.io bulk read(...) end-of-stream return value descriptions ambiguous
-
- Closed
-