Bug 21270 - BufferedReader.read( char[], int, int ) returns less than expected number of read chars
Summary: BufferedReader.read( char[], int, int ) returns less than expected number of ...
Status: RESOLVED DUPLICATE of bug 18376
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-28 19:36 UTC by mnefedov
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mnefedov 2005-04-28 19:36:06 UTC
When 8K of data is requested gcj returns only 2K (Sun's VM returns full 8K).

example code:

import java.io.*;

public class BufferedReaderReadTest {
	public static void main( String [] args ) throws Exception {

		char [] b = new char[ 8 * 1024 ];

		BufferedReader in = new BufferedReader( new FileReader( args
[0] ), 8 * 1024 );

		System.out.println( "read() = " + in.read( b, 0, b.length ) );

		in.close();
	}
}
Comment 1 Andrew Pinski 2005-04-28 19:45:04 UTC
Note BufferedReader does not need to read in the full buffer, it actually is a non blocking reader:
From <http://java.sun.com/j2se/1.4.2/docs/api/java/io/
BufferedReader.html#read(char[],%20int,%20int)>
The ready method of the underlying stream  returns false, indicating that further input requests  would 
block.

so I don't know if this is a real bug or not.
Comment 2 Andrew Pinski 2005-04-28 21:52:26 UTC

*** This bug has been marked as a duplicate of 18376 ***