JDK-4178064 : java.io.FileInputStream.skip returns incorrect result at EOF
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.2.0,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt,windows_2000
  • CPU: x86
  • Submitted: 1998-10-01
  • Updated: 2013-05-09
  • Resolved: 2002-05-09
Related Reports
Duplicate :  
Relates :  
Relates :  
Description

Name: mr33420			Date: 10/01/98


Start reading a file byte-by-byte. Once you reach
end-of-file, give inputStream.skip(5) (to skip 5 bytes).
Instead of returning -1 (since no bytes can be 
skipped), skip(long) returns the actual bytes 
asked to skip (in this case 5 bytes). 
Since skip(long) does not return -ve number, I
tried to read from file (and have not closed the file yet)
Read method returns -1 which specifies that EOF is
really reached. Isn't this bug related to skip method ?
(Review ID: 38778)
======================================================================

Comments
WORK AROUND Name: mr33420 Date: 10/01/98 Close the inputStream when EOF is reached and then again read the stream if required. ======================================================================
11-06-2004

EVALUATION See comments in 4180942. -- mr@eng 1999/1/13
01-07-0179