Questions tagged [inputstreamreader]
216 questions
0
votes
2 answers
How BufferedReader works in java
I want to know how the BufferedReader works? Why InputStreamReader is used with it? How it differs from the Scanner class which is also used to take user input?
Which among the two is better?

Frosted Cupcake
- 1,909
- 2
- 20
- 42
0
votes
2 answers
How can I read a UTF-8 text file from a jar using the Java method Class.getResourceAsStream()?
I have a UTF-8 file stored inside a java jar file. I am trying to read it using the method getResourceAsStream(), but the input stream reader that is returned by the function uses the default encoding, which is the ANSI one under Windows.
How can I…

axilmar
- 836
- 1
- 13
- 17
0
votes
1 answer
How to change a file reader to a directory scanner?
Answer
System.out.print("Enter the name of the directory:");
File a= new File((new BufferedReader(new
InputStreamReader(System.in))) .readLine());
File[] b=a.listFiles();
for(int i=1;i < b.length;i++){
fn=b[i].getPath();…

Pietro Sette
- 62
- 8
0
votes
1 answer
java hadoop: FileReader VS InputStreamReader
i want use my java class on the hadoop hdfs, now i must rewrite my functions.
the problem is, if i use the InputStreamReader my app read wrong values.
here my code (so it's work, i want use the uncommented code part):
public static…

Pa Rö
- 449
- 1
- 6
- 18
0
votes
1 answer
Can not read text files
I am trying to write and read a text file which is full of words and add it to an ArrayList. The ArrayList later is used from another part of the program to display text in a TextView. But when i run the program and open the specific part of it,…

Silas
- 21
- 4
0
votes
3 answers
Java extract text from text file from a certain point on the text
I have created a method with BufferedReader that opens a text file created previously by the program and extracts some characters. My problem is that it extracts the whole line and I want to extract only after a specified character, the :.
Here is…

fselva
- 457
- 1
- 7
- 18
0
votes
1 answer
Reading bytes from a file
I am reading from a ".264" file using code below.
public static void main (String[] args) throws IOException
{
BufferedReader br = null;try {
String sCurrentLine;
br = new BufferedReader(new InputStreamReader(new…

Bilal Ahmed
- 37
- 4
0
votes
1 answer
I made a simple android app so far and its not working. InputBufferedReader is the cause I think
Added alot of tv.setText( ) in order to know which of the lines are being executed and where does the try block breaks. The ending result of 'tv' is 4.
public class Main extends Activity {
@Override
protected void onCreate(Bundle…

Taha
- 13
- 5
0
votes
1 answer
inputstreamreader.read and string.copyvalueof
I don't really understand what this piece of code does. I mainly want to know what isr.read(inputBuffer) processes and what the while loop does. Could someone explain it for me? Thanks.
InputStreamReader isr = new InputStreamReader(is);
int…

ShroudDx
- 3
- 2
0
votes
1 answer
Java Server - How to take input from InputStreamReader and convert to a String?
I'm trying to get a very simple Client-Server system to work, where the Client will send a String over to the Server, and the server will then store that String into a file.
The client sends the string through:
//Other Code
sockStrm = new…

GhostSarge
- 3
- 2
0
votes
1 answer
BufferReader buffer = new BufferReader() Gives me an ERROR NullPointerException and It stops there with Debug
I tried running this code on Eclipse and it was me an error. I'm trying to send a HTTP to a php site and get the response as a TextView.
login.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
…

Johnathan Logan
- 357
- 5
- 14
0
votes
2 answers
Output from exec not writing to a file in java
From within my Java code, I have a call to an external program, I use the following:
int returnCodeC = 0;
String cmnd = "dia -fa -fn res" + file1;
final Process processCC = Runtime.getRuntime().exec(cmnd);
BufferedReader bufC = new…

SLA
- 363
- 2
- 4
- 11
0
votes
2 answers
JAVA: Open and read file using InputStreamReader
I'm trying to read a binary file (pdf, doc, zip) using InputStreamReader. I achieved that using FileInputStream, and saving the contents of file into a byte array. But i've been asked to do that using InputStreamReader. So when i'm trying to open…

yakamuki
- 106
- 1
- 1
- 8
0
votes
4 answers
Encoding ignored while reading InputStream
I'm having some encoding problems in a Java application that makes HTTP requests to an IIS server.
Iterating over the headers of the URLConnection object I can see the following (relevant) headers:
Transfer-Encoding: [chunked]
Content-Encoding:…

guanabara
- 590
- 1
- 9
- 22
0
votes
1 answer
Equivalent of FileReader for Java resources
Is there a utility class (e.g. in commons-io or Guava, if not in core Java) that's the equivalent of FileReader, but for resources? I mean, yes, I can write
Reader myReader = new InputStreamReader(getClass().getResourceAsStream("myResource"));
but…

David Moles
- 48,006
- 27
- 136
- 235