Questions tagged [stringwriter]

StringWriter class could refer to java.io.StringWriter (part of the the standard java io library ) or to System.IO.StringWriter (part of .NET framework)

StringWriter class could refer to java.io.StringWriter (part of the the standard java io library ) or to System.IO.StringWriter (part of .NET framework)

76 questions
3
votes
2 answers

Using BufferedWriter to write to a string

I am trying to use a BufferedWriter to switch between writing to a File and writing to a String, but I have never used a BufferedWriter to write to anything but a file. Take this compilable code: public static void main(String[] args) { try…
ryvantage
  • 13,064
  • 15
  • 63
  • 112
3
votes
1 answer

Pass a VIEW as a STRING

Attempting to use the example on http://weblog.west-wind.com/posts/2012/May/30/Rendering-ASPNET-MVC-Views-to-String to pass a VIEW as a string, and send as an Email. Which should send the invoice of a sale through email to the user. Iv'e added…
John
  • 3,965
  • 21
  • 77
  • 163
3
votes
2 answers

add header to the XDocument, and schema

I want to have xml like 1 . . . . 9 so I use…
AMH
  • 6,363
  • 27
  • 84
  • 135
3
votes
0 answers

Printing huge string to Logcat

What is the best way to print XML-string to the Logcat window? The string I am trying to print out is a actually a StringWriter which contain a lot of data, when I try to print it out the Logcat truncates it and does not print out the whole content…
Araw
  • 2,410
  • 3
  • 29
  • 57
3
votes
3 answers

Why StringWriter.ToString return `System.Byte[]` and not the data?

UnZipFile method writes the data from inputStream to outputWriter. Why sr.ToString() returns System.Byte[] and not the data? using (var sr = new StringWriter()) { UnZipFile(response.GetResponseStream(), sr); var content =…
theateist
  • 13,879
  • 17
  • 69
  • 109
3
votes
2 answers

Add a title when exporting gridview data to a doc file

I have some Sql Server database, and I return the data with this method: protected DataTable GetProductsData() { if (ddTipRaport.SelectedItem.Text == "Toate Cerintele") { DataTable dt = new DataTable(); …
TBogdan
  • 737
  • 7
  • 17
  • 34
2
votes
3 answers

C# Compact Framework - OutOfMemoryException with XmlSerializer.Serialize

I'm trying to serialize a large collection of objects (20,000) objects within the collection. I'm doing this using the following code: XmlSerializer xs = new XmlSerializer(deserialized.GetType()); StringWriter sw; using (sw = new StringWriter()) { …
djdd87
  • 67,346
  • 27
  • 156
  • 195
2
votes
1 answer

XML StringWriter empty

I have some XML in a XMLDocument and I want to put it into a StringWriter, but it always becomes empty(?) instead. I've tried inspecting the variables with debug, but I'm still clueless as to what's going on. Here's what I have: XmlDocument…
rlb.usa
  • 14,942
  • 16
  • 80
  • 128
2
votes
1 answer

using stringwriter getting encoding problems

i have used StringWriter writer = new StringWriter(); request.setCharacterEncoding("ISO-8859-1"); response.setContentType("text/html;charset=ISO-8859-1"); pw =response.getWriter(); IOUtils.copy(sImage, writer); theString =…
pras
  • 21
  • 1
  • 2
2
votes
0 answers

Adding a Listener to a StringWriter

I have a class that creates StringWriters and passes them around. A calling class will write to that Writer. Is there any way for me to put some sort of Listener on the Writers as they are being created to let me know when their contents change? I…
chama
  • 5,973
  • 14
  • 61
  • 77
2
votes
1 answer

Why are \r\n added to my string?

\r\n appearing on string? Attempting to use the example on Rendering ASP.NET MVC Views to String to pass a VIEW as a string, and send as an Email. Which should send the invoice of a sale through email to the user. Iv'e added ViewRenderer class to my…
John
  • 3,965
  • 21
  • 77
  • 163
2
votes
4 answers

String Writer writing into text file

I have 100 textboxes , and i am trying to get all the text from these textboxes to be written into a textfile , this is my code : protected void Page_Load(object sender, EventArgs e) { for (int i = 0; i <= 9; i++) { for (int j = 0;…
user2376998
  • 1,061
  • 7
  • 32
  • 65
2
votes
1 answer

Android Programming How to Get XML String Ordered Tags

I wrote This Code.It works great.But i have a trouble with its output string. public static String CreateIndexForImage() throws IllegalArgumentException, IllegalStateException, IOException { String Image_Name = "Bla BLa"; static…
COvayurt
  • 827
  • 2
  • 11
  • 36
1
vote
0 answers

Why Java StringWriter close method throws IOException?

I wonder why Java designers made close() method on StringWriter throwing the IOException, when it actually does nothing. E.g. in PrintWriter, the exceptions are suppressed even though the PrintWriter really can do something when it uses an…
Mi-La
  • 685
  • 10
  • 18
1
vote
2 answers

Why does Javascript not function properly when my user control is rendered?

I am using a combination of HTMLTextWriter and StringWriter to render my user controls. The code used to render the user control is initiated through an ajax call from some Javascript on my page. The resulting StringWriter text is returned to the…
Andy F
  • 1,517
  • 2
  • 20
  • 35