Questions tagged [inputstreamreader]

216 questions
1
vote
2 answers

Stream data display in jsp

My service returns Stream data like this... return new BufferedReader(new InputStreamReader(process.getInputStream())); I want to display the stream data in jsp page.. This shows what is going on in cmd peompt... My jsp page Should display the…
Muthu
  • 1,550
  • 10
  • 36
  • 62
1
vote
1 answer

Read file from res folder in J2ME

I've tried this code but always get me 'is' as NULL. My file is located at "res" folder. StringBuffer str = new StringBuffer(); InputStream is = getClass().getResourceAsStream(filename); if(is == null) { System.out.println("'is' is…
vicmonmena
  • 41
  • 1
  • 2
  • 8
1
vote
3 answers

What's the charset of text returned by InputStreamReader(InputStream in, Charset cs)

I read a UTF-8 file by: br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), Charset.forName("UTF-8"))); I would like to know what's the charset of returned String after I invoke br.readLine()? Eclipse on my Computer uses…
Hesey
  • 4,957
  • 6
  • 31
  • 31
1
vote
1 answer

Can UTF8 validation be done on a char[], or must it be done at the original byte[]?

I am attempting to validate that files I am ingesting are all strictly UTF8 compliant, and through my several readings, I have come to the conclusion that if the validation is to be done correctly, the original, untampered bytes of the data must be…
John Lexus
  • 3,576
  • 3
  • 15
  • 33
1
vote
1 answer

Why does InputStreamReader giving me U-FFFD? How can I fix it?

I am trying to receive data from bluetooth device which is expected to be in this format: 00 FE 80 01 01 A0 0A B0 0B C0 0C D0 0D E0 0E F0 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23…
CarloDp
  • 13
  • 3
1
vote
1 answer

Fetching data from InputStream in java

I am trying to fetch data from InputStream using InputStreamReader and my code is given below. protected String doInBackground(String... urls) { String result = ""; URL url; HttpURLConnection urlConnection = null; try { url…
1
vote
0 answers

Difference between InputStreamReader in java 1.6 and java 1.7

I have a issue with encoding conversion in java 1.7 but not in java 1.6. The code is like this: import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { String inStr =…
1
vote
0 answers

How to import output from CMD into JTextpane line by line

I have textField where i write cmd command and i want to get output results from CMD imported into JtextPane. I am getting that but after i execute some command entire output is imported into the textpane instantly and i want to be written line by…
markou
  • 11
  • 1
1
vote
3 answers

Converting Scientific notation values into numeric one while reading csv file which is serialized automatically

I have a csv file which I have to import into data base. When reading the file by stream reader, some values are converted into scientific notation like "5.00E+11". I have to restore this into original values. This is being done by a job, so I can…
1
vote
0 answers

Content cuts off when trying to return all of URL http content

I'm trying to return the http content from a website. However, not all of the content shows. I'm using Android Studio 3.1.4, SDKVersion 27. For reference, this is part of an exercise in the online Udemy course: The Complete Android N Developer…
1
vote
2 answers

Java InputStreamReader tries to read whole stream?

I'm trying to read UTF-16 string from a Socket. And the point is I don't know its length in bytes before I read first few chars of the string. So I've opened InputStreamReader like this: InputStreamReader reader = new InputStreamReader(inputStream,…
user1748526
  • 464
  • 5
  • 18
1
vote
5 answers

randomly select a line in a textfile c# streamreader

Hi I am reading from a text file and would like each line to be put into a seperate variable. From what I remember from my programming classes arrays cannot be dynamic. So if I set 15 arrays, and the text file has 1000 lines what can I do and how do…
mintuz
  • 735
  • 1
  • 18
  • 40
1
vote
2 answers

InputStreamReader throws NullPointerException

First of all the code snippets below are part of a Google Cloud Project application and are running on my local client which is a Raspberry Pi 1. In order to be able to send data from a sensor connected to the Pi to the cloud an authorization is…
1
vote
1 answer

Java InputStreamReader from URL does not encode "Umlaute"

I try to read the html content from an URL. When I wan't to print the content to the console "Umlaute" like ä, ö, ü are displayed wrong. URL url = new URL("http://www.lauftreff.de/laeufe/halbmarathon-1-2017.html"); URLConnection conn =…
Sigma
  • 37
  • 5
1
vote
1 answer

How do I read only one line of text file?

My program is reading all lines in the file but i just need the second one. String line; try ( InputStream fis = new FileInputStream(source); InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8")); BufferedReader br…