Scanner cuts off my String after about 2400 characters
Posted
by Ventrue
on Stack Overflow
See other posts from Stack Overflow
or by Ventrue
Published on 2010-05-23T07:42:30Z
Indexed on
2010/05/23
7:50 UTC
Read the original article
Hit count: 239
I've got some very basic code like
while (scan.hasNextLine())
{
String temp = scan.nextLine();
System.out.println(temp);
}
where scan is a Scanner over a file.
However, on one particular line, which is about 6k chars long, temp cuts out after something like 2470 characters. There's nothing special about when it cuts out; it's in the middle of the word "Australia." If I delete characters from the line, the place where it cuts out changes; e.g. if I delete characters 0-100 in the file then Scanner will get what was previously 100-2570.
I've used Scanner for larger strings before. Any idea what could be going wrong?
© Stack Overflow or respective owner