Questions tagged [inputstreamreader]
216 questions
1
vote
0 answers
Java Arab UTF-8 encoding not the same as Notepad++ UTF-8 encoding
I am currently writining a program, that is supposed to read arab lines from xml/properties files and display it in a JTable.
Thats my InputStreamReader:
new InputStreamReader(new FileInputStream(f), "UTF-8");
My problem is, that for example this…

Tobias Marschall
- 2,355
- 3
- 22
- 40
1
vote
1 answer
Java.io Two ways to obtain buffered character stream from unbuffered byte one
I am switching to Java from c++ and now going through some of the documentation on Java IO. So if I want to make buffered character stream from unbuffered byte stream, I can do this in two ways:
Reader input1 = new BufferedReader(new…

Anton Zyablitskiy
- 37
- 4
1
vote
2 answers
Is it necessary to close an InputStreamReader in a BufferedReader
We all know that it is a good habit to close all the StreamReaders we have defined at the end of code.
Now we can see that two Readers was defined as below. BufferedReader and InputStreamReader.The BufferedReader was closed, but we are unable to…

xialu
- 174
- 3
- 11
1
vote
1 answer
Java InputStreamReader, different output on mac and linux
Im trying to get this to work on a mac, it works just fine on linux.
public class URLTest {
public static void main(String[] args) {
try{
String webpage="Insert random webpage here";
InputStream in = new…

Thorstennn
- 13
- 3
1
vote
3 answers
BufferedReader / AsynchTask- java.lang.NullPointerException: lock == null
I am working on an Android App and I am stuck on an error. I am attempting to communicate with a server and get a JSON object from that server. I made a class called ServerCommunication which extends AsynchTask. My server communication class has the…

Matt Halleran
- 25
- 1
- 6
1
vote
0 answers
Java InputStreamReader reading nonexistent data
I'm testing some code that reads data from a text file off of the internet using InputStreamReader. It worked the first time and returned the correct results; however, I've tried changing the contents of the file and even removing the file off of…

user2060086
- 21
- 2
1
vote
1 answer
HttpsURLConnection and Charset for InputStreamReader?
In the code below:
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestProperty("charset", "utf-8");
InputStream input = connection.getInputStream();
InputStreamReader reader = new…

jww
- 97,681
- 90
- 411
- 885
1
vote
1 answer
can't receive server full response
I'm using Java Socket Programming in order to receive server responses, I'm using a char array and read each response in it using read() method:
InputStream stream = null;
try{
stream = socket.getInputStream();
}catch(Exception e){
…

Muhammed Refaat
- 8,914
- 14
- 83
- 118
1
vote
0 answers
Java I/O performance Streams vs Reader/Writer
I have tried two snippets of Java 1.7 code:
Snippet 1:
try {
BufferedReader in = new BufferedReader(
new InputStreamReader(myInputStream)); //from the Internet
String s;
out = new PrintWriter(new…

Java Addict
- 175
- 8
1
vote
1 answer
BufferedReader blocking when reading from process.getErrorStream()
When I run this code and the call graph is really large, the program prints to the last line that opt outputs and is blocked at readLine, even though there is nothing left. Anyone know what the problem is? opt -print-callgraph file sends the call…

gruuuvy
- 2,028
- 4
- 31
- 52
1
vote
2 answers
How to read odd number position words
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class Example {
public static void main(String[] args) throws IOException
{
File fis=new…

Manivannan
- 57
- 3
1
vote
1 answer
can BufferedReader read a text file hosted online?
Say I have a url
www.hosting.com/words.bin
how would I read the words hosted in that URL?
I've tried
try {
URL url = new URL(FILE_NAME);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
String word;
while ((word…

Gwen Wong
- 357
- 3
- 15
1
vote
3 answers
IOException with BufferedReaders and InputStreamReaders
I am modding Minicraft, and I am running into a bit of trouble using BufferedReaders.
So in my mod, I have a class called FuncResource in which I define a way to execute a custom method when an item is used.
In the Resource vanilla class, I…

Atutouato
- 375
- 4
- 13
1
vote
1 answer
Can't close InputStreamReader
I have some weird problem on Android 2.2 phone.
I open the socket connection:
socket = new Socket(serverAddr, SERVERPORT);
messageWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(),…

mgulan
- 795
- 1
- 14
- 33
1
vote
3 answers
Java- Issue with opening and Scanning file
I am writing a program in Java, it scans a file, counts lines, character, palindromes, words. My problem is when I ask for a filename, I am using BufferedReader and InputStreamReader to scan the file the user provided, and print the results in…

octain
- 964
- 3
- 10
- 24