Questions tagged [inputstreamreader]
216 questions
4
votes
2 answers
java.io dilemma
The classes java.io.Reader and java.io.InputStreamReader both have read methods with the exact same signature
public int read(char[] charbuf, int offset, int length) throws IOException
Now according to the java documentation the class…

Surender Thakran
- 3,958
- 11
- 47
- 81
3
votes
1 answer
How to get InputStreamReader in ISO-8859-15?
How can I make this inputstream read a ISO-8859-15 encoded file?
BufferedReader r = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.jet)));
I found this line which seemingly works:
BufferedReader br = new…

fred
- 1,812
- 3
- 37
- 57
3
votes
2 answers
Do I need to close InputStreamReader even if InputStream should remain open?
The InputStream is passed as a parameter from somewhere, where it will be further processed and then closed. So I don't want to close the InputStream here. Consider the following code:
void readInputStream(final InputStream inputStream) {
final…

entreprenr
- 346
- 2
- 13
3
votes
1 answer
Reading very large text files in java
I'm using the following code to read large files:
InputStreamReader isr = new InputStreamReader(new FileInputStream(FilePath));
BufferedReader br = new BufferedReader(isr);
while ((cur = br.readLine()) != null)
I'm able to read large files using…

Mayank
- 113
- 3
- 15
3
votes
2 answers
Facebook Graph Java HttpsURLConnection returns error 400
I'm trying to download some data from Facebook Graph via the web api and everything worked fine until now, somehow, this code is giving me a 400 error instead of the json response
URL url = new URL(link);
URLConnection urlConn =…

DomeWTF
- 2,342
- 4
- 33
- 46
3
votes
3 answers
Testing a buffered reader reading from input stream
I have problems when testing my code. I think that the problem has to do with using a BufferedReader reading from an InputStreamReader.
I used IntelliJ and give the following input:
Hello
World!
Why is my program not printing anything? Here is my…

Jeni
- 31
- 2
3
votes
4 answers
while loop with a readLine()
Here is my question: normal while loop looks like this -
while(condition){statements}
and statements execute until condition becomes false and the loop is over. I'm interested in logic of this kind of statement:
while((a=b.readLine) != null) {…

Seba
- 33
- 1
- 1
- 5
3
votes
1 answer
BufferedReader input attempt from System.in throwing exceptions
I am trying to read a from the input using BufferedReader. It works the first time but the second time it is ran I get an exception.
john@fekete:~/devel/java/pricecalc$ java frontend.CUI
> gsdfgd
Invalid command!
> I/O Error getting string: …

John Tate
- 780
- 3
- 10
- 23
3
votes
4 answers
How can I read from a BufferedReader in Java without blocking?
I want to send a command to a server, and find out if I get a response.
Right now i am using BufferedReader's readline() function, which blocks until there's a response from server, but all I want to do is verify that there's a response from the…

Amir.F
- 1,911
- 7
- 29
- 52
2
votes
1 answer
InputStreamReader, FileInputStream starts parsing file at midpoint instead of beginning
I'm attempting to parse a UTF 16 encoded JSON file, however I've run into a weird issue.
Whenever I use a FileInputStream, parsing the file seems to start at the midpoint. For example, if the file is 40 characters long, it will begin at character…

Chris Salij
- 3,096
- 5
- 26
- 43
2
votes
1 answer
Make Android Http BufferedReader more efficient?
I have this code, which contains a BufferedReader and reads the HTML data from a website. However, every page from the site which I'm loading contains like 600 lines of HTML, so it takes a long time for it to read the data every time. I want to the…

ZimZim
- 3,291
- 10
- 49
- 67
2
votes
2 answers
BufferedReader stuck at last input line without ending the program
I'm using BufferedReader to read data from System.in (a text file redirected context: < file.txt) then write it to the console. The problem is my program shows all lines except the last one and still works without doing any thing. If I manually end…

Aymen Soussi
- 33
- 4
2
votes
4 answers
Reading the content of web page
Hi
I want to read the content of a web page that contains a German characters using java , unfortunately , the German characters appear as strange characters .
Any help please
here is my code:
String link = "some german link";
URL url…

M.M
- 1,343
- 7
- 20
- 49
2
votes
0 answers
How to store more than String's limit in a variable in Groovy?
In process of converting a variable of Data Type InputStreamReader (stdout) into String (s) I am reading few characters of 'stdout' at a time through 'ca' and appending it to 's'. However since the data to be read is too long, I think after some…

Anjali Srivastava
- 21
- 4
2
votes
0 answers
How to read a file placed in the resources folder?
I am trying to read a file placed in the resources folder in my java project. I went trough many topics how to handle that but I cannot succeed coming up with NullPointerException. Could you please help me?
I have already tried many versions of…

supercolo
- 171
- 1
- 8