JDK-4030995 : Incorrect # of bytes returned by BufferedInputStream.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.1,1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_95
  • CPU: x86
  • Submitted: 1997-02-07
  • Updated: 1997-02-07
  • Resolved: 1997-02-07
Related Reports
Duplicate :  
Duplicate :  
Description

Name: mc57594			Date: 02/07/97


If you use the read(byte[], int, int) method of BufferedInputStream, the number of bytes read might be less than you requested (even if that many of more bytes are still unread in the file).

(Presumably, the buffer in memory was emptied with the read, and Java only returns the number of bytes left in the buffer)
company  -    , email  -  ###@###.###
======================================================================

Comments
EVALUATION Not a bug. Java is not Unix: The JLS allows this behavior.
11-06-2004

WORK AROUND Name: mc57594 Date: 02/07/97 Check if you read the number of bytes you requested. If you read less than you requested and available() > 0, then perform another read to get the remaining bytes. ======================================================================
11-06-2004