Questions tagged [inputstreamreader]
216 questions
2
votes
3 answers
Cannot find Symbol in Java try block
Fairly new to Java and I'm trying to use a fileChooser to open a file and read the information. I'm at the stage where I am trying to create a fileInputStream and inputStreamReader. When creating I was being given a FileNotFoundException despite the…

Alesi Rowland
- 379
- 2
- 16
2
votes
3 answers
IOException: stream is closed, NullPointerException with HttpURLConnection disconnect
everyone. I'm coding a function that connects to a server by using Class HttpURLConnection. In the code, I establish a connection, call getOutputStream() and getInputStream() methods in order. Then I disconnect the connection. After this, I try to…

phinux
- 21
- 3
2
votes
3 answers
Multiple times stream close and open on same file error
I am trying to read input from console using two classes in the same method InputStreamReader and BufferedReader . I have closed the stream of former class and read input again but now using latter class. It is showing error if I close the former…

angrysumit
- 221
- 4
- 16
2
votes
4 answers
What does this condition do (BufferredReader and InputStreamReader)?
I'm currently reading a code and i found a method starting like this :
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
}
Can someone explain me…

Csi
- 526
- 3
- 22
2
votes
2 answers
cannot be resolved to a variable in a for loop in a loop
i cannot seem to get the bottom "i" to link to a variable in the for loop below where have i gone wrong?? i have tried to edit it change the variable and put the variable above the for loop all i get is error
also i am using eclipse luna
import…

Big Moe Pasha
- 59
- 2
- 3
- 11
2
votes
3 answers
Bad comparison of nonnegative value with -1
FindBugs is reporting me that I'm comparing nonnegative value with -1 for the following code.
/* I get inputstreamreader from a org.apache.commons.net.telnet.TelnetClient object */
InputStreamReader reader = telnet.getInputStream();
char msg =…

Ravi Kiran
- 21
- 2
2
votes
1 answer
How to fix java.io.FileNotFoundException: Response: '404: Not Found' for url: 'http://localhost:7001/Socket-war/Servlet'
I am using the code below to invoke a servlet from my Java class :
URL url = new URL( "http://localhost:7001/Socket-war/Servlet" );
new BufferedReader(new InputStreamReader(url.openStream()));
Getting an Exception: …

Developer
- 161
- 2
- 3
- 15
2
votes
3 answers
How to manage delaying of receiving server responses?
I'm developing an android app that requires me to get some data from a server in the run_time in order to display it on the app, these data comes in the form of json commands, the point here is that the server sends the data without an end line (/n)…

MRefaat
- 515
- 2
- 8
- 22
2
votes
3 answers
Java InputStream . Is there is Correct And Efficient way?
I am working on Bluetooth Application on Android. This inputStream is from connection socket. I want to read bytes upto certain length.
First way I tried :
byte[] data = new byte[lengthtoread];
for (int i = 0; i < data.length; i++)
data[i]…

Vinit Siriah
- 327
- 3
- 12
2
votes
3 answers
Printing initials of user input name of any length along with full surname in java
I am new to java and I have been trying to solve a problem which I feel might have a simpler answer than my code.The problem was to print the initials of a user input name of any length along with the full surname.But this has to be done without any…

Abhinav
- 182
- 1
- 3
- 12
2
votes
2 answers
Process.waitFor() a thread
While running an external script, I want to read the ErrorStream and OutputStream of this script both simultaneously and separately and then process them further. Therefore, I start a Thread for one of the streams. Unfortunately, the Process doesn't…

stan
- 95
- 2
- 8
2
votes
1 answer
out of memory when converting a large stream to string
I am trying to convert a large stream (4mb) to a string which i eventually convert it to a JSON Array.
when the stream size is small ( in KB ) every thing works fine, the minute it starts to process the 4mb stream it runs out of memory
below is what…

Leon Leony
- 21
- 1
- 3
2
votes
2 answers
Slow reading of HTTP response using InputStreamReader and BufferedReader?
I have the following code in Java that sends an HTTP request to a web server and read the response:
StringBuilder response = new StringBuilder(50000);
URL url2 = new URL(ServiceURL);
connection =…

herrfz
- 4,814
- 4
- 26
- 37
2
votes
4 answers
Adding an integer to a vector
Hi guys while reading a stream of input data we use
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
If BufferedReader is so good to read streams why cant we just use
BufferedReader stdin=new…

user1741642
- 61
- 1
- 1
- 4
1
vote
5 answers
InputStreamReader and reading random lines from .txt file
I have a method for my app to read a random line from a text file and return it. Im using the randTxt() to read and return a random line from the txt file.
but it only shows the same line (1st line) everytime.
public String randTxt(){
// Read in…

Nima
- 6,383
- 7
- 46
- 68