Reputation: 483
I am trying to read all the words as a String from the url - http://www.puzzlers.org/pub/wordlists/unixdict.txt
But the outputted String has some part of the strings missing whenever there is a '
I am getting the same error when using String builder instead of concatenating.
public static String getUrlContents(String theUrl) throws IOException {
URL url = new URL(theUrl);
URLConnection urlConnection = url.openConnection();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String line;
String text = "";
while ((line = bufferedReader.readLine()) != null) {
text += line + " ";
}
bufferedReader.close();
return text;
}
Output:
After ain' huge blank and then continues from 'd anyhow
and it continues after
So it's eating up the text between two subsequent '
and '
Looks like the text is there, since when I search for antony
which is between the blanks the eclipse highlights the word as seen below, but it's not visible on my screen :O
Upvotes: 1
Views: 166
Reputation: 23012
As already answered by Naruto
that console has buffer size and above that size content is not visible. To check whether your string is correct or not, just copy whole content from console CTRL+A and paste in notepad file, I'm sure you will see complete content.
Basically it's not a bug but predefined size of the console, you can change it as well at (Window > Preferences > Run/Debug > Console
).
Another way is just use Fixed Width Console and set Max size which is 1000
and you will be able to see the content in the console.
Upvotes: 1