Questions tagged [stringreader]
90 questions
36
votes
4 answers
StringBuilder Vs StringWriter/StringReader
I recently read that in StringWriter and StringReader are used for writing and reading from StringBuilder.
Well when I use StringBuilder Object, it looks to be a self sufficient class.
We have every way of reading and writing the StringBuilder,…

SaravananArumugam
- 3,680
- 6
- 33
- 45
30
votes
2 answers
How to replace StringBufferInputStream with StringReader?
Using JNLP, I have this line :
File_Save_Service.saveFileDialog(null,null,new StringBufferInputStream("testing"),null);
How to replace StringBufferInputStream with StringReader in this line ? The API for StringBufferInputStream says better use…

Frank
- 30,590
- 58
- 161
- 244
23
votes
5 answers
Should I close a StringReader?
I use a StringReader to turn a string into something I can upload to an SFTP server (it takes a stream). Is there any point in closing that StringReader afterwards? As far as I can see in the source it just sets the string to null...
I could just do…

Svish
- 152,914
- 173
- 462
- 620
21
votes
10 answers
How do I convert a StringReader to a String?
I'm trying to convert my StringReader back to a regular String, as shown:
String string = reader.toString();
But when I try to read this string out, like this:
System.out.println("string: "+string);
All I get is a pointer value, like…

Zibbobz
- 725
- 1
- 15
- 41
11
votes
3 answers
Why Java StringReader throws IOException?
Today I was working with Java class StringReader and I found it very annoying that it throws IOException on read method. I know that it extends Reader class in which method read throw IOException but I think that it is not needed for StringReader.…

Paweł Adamski
- 3,285
- 2
- 28
- 48
8
votes
2 answers
Ignoring specified encoding when deserializing XML
I am trying to read some XML received from an external interface over a socket.
The problem is that the encoding is specified wrong in the XML-header (it says iso-8859-1, but it is utf-16BE). It is documented that the encoding is utf-16BE, but…

Holstebroe
- 4,993
- 4
- 29
- 45
6
votes
4 answers
C# StringReader Class
I have this problem, I'm using StringReader to find specific words from a textbox, so far is working great, however I need to find a way how to check specific words in every line against a string array.
The following code works:
string txt =…

Hocsan Moya
- 63
- 4
5
votes
4 answers
C# Read text file line by line and edit specific line
I want to read a text file line by line and edit a specific line. So, I have put the text file into a string variable like:
string textFile = File.ReadAllText(filename);
My text file is like:
Line A
Line B
Line C
Line abc
Line 1
Line 2
Line 3
I…

Giovanni19
- 135
- 1
- 2
- 7
5
votes
1 answer
How to string multiple TextReaders together?
I have 3 TextReaders -- a combination of StreamReaders and StringReaders. Conceptually, the concatenation of them is a single text document.
I want to call a method (not under my control) that takes a single TextReader. Is there any built-in or…

Ken
- 396
- 2
- 4
5
votes
3 answers
Tagsoup fails to parse html document from a StringReader ( java )
I have this function:
private Node getDOM(String str) throws SearchEngineException {
DOMResult result = new DOMResult();
try {
XMLReader reader = new Parser();
…

zajcev
- 303
- 2
- 7
4
votes
5 answers
How to reset position in StringReader to begining of String?
I have the following code:
StringReader contentReader = new StringReader(this.dataContent.ToString());
After I parse my DataContent, I need to reset the poistion of the contentReader to begining of the string. How do I do it? I dont see a set…

savi
- 497
- 2
- 12
- 27
4
votes
1 answer
Can not unmarshall the SOAP response
I could send a request and receive the response but I can not parse the response. It returns the following error:
Local Name:Body
error is here
java.lang.NullPointerException
at…

J888
- 1,944
- 8
- 42
- 76
3
votes
1 answer
Receiving binary Data from a rest endpoint
I am new to API/Rest endpoints, so please forgive my inexperience on this topic.
I am using .net core 3.1. And i have been tasked to write an endpoint, that excepts two parameters a string and a file..
The file will be of binary data (a .bci file…

sinfella
- 246
- 2
- 19
3
votes
2 answers
StringReader gives error from String.Split output
I got an exception when using StringReader. The string that I parse when creating object was produced trough String.split, it gives me NullPointerException. Any suggestion how to fix this?
Here's the code:
public static void main(String[] args)…

jajamaharaja
- 135
- 14
3
votes
1 answer
Append StringReader For Multiple Entries
I'm creating a program in Java that reads a string of XSL-FO code, populates the empty fields with app data, and adds it to a StringReader, to eventually be set as an InputSource for a web dispatcher.
I already have the code to find and populate…

Zibbobz
- 725
- 1
- 15
- 41