Questions tagged [writer]

an abstract class, interface or naming convention which is used to state that the given object is used to write data to a file, stream, device or other destination

A Writer clause is often used as a part of a name of an object in object-oriented programming. Good examples are BufferedWriter from Java 6 or StreamWriter from C#.

Abstract writers are often defined as interfaces or abstract classes to provide means of making the process of writing separable from what is being written. In Java or .NET there are Writer implementations for files, network connections and, more general, streams.

456 questions
11
votes
4 answers

Java - How to detect file deletion while writing to a file?

Our java program writes some important data into a file continuously. Now we want to thrown some exception or display some kind of error message on the console whenever the file (to which the java program is writing) is deleted by some user…
Amit
  • 33,847
  • 91
  • 226
  • 299
11
votes
4 answers

Iterate Java Map with index

How can I iterate a Map to write the content from certain index to another. Map map = new LinkedHashMap<>(); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file)); for (String string :…
Sam Joos
  • 430
  • 2
  • 11
  • 25
10
votes
2 answers

Writer not working for json file using Gson ,json file is blank after code execution

I'm trying to write json data to a json file. After code execution no errors are thrown but the .json file is empty. Please find below code and help on this import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import…
Ramesh Raj
  • 185
  • 1
  • 2
  • 13
10
votes
4 answers

Empty space in between rows after using writer in python

I am using csv package now, and every time when I write to a new csv file and open it with excel I will find a empty row in between every two rows. filereader = csv.reader(open("tests.csv", "r"), delimiter=",") filewriter =…
user1998777
  • 159
  • 1
  • 2
  • 10
9
votes
4 answers

Thread safe StreamWriter C# how to do it? 2

So this is a continuation from my last question - So the question was "What is the best way to build a program that is thread safe in terms that it needs to write double values to a file. If the function that saves the values via streamwriter is…
user349026
8
votes
2 answers

Good and simple Ruby XML writer?

Does anyone know of an easy to use Ruby XML writer out there? I just need to write some simple XML and I'm having trouble finding one that's straightforward.
Tony R
  • 11,224
  • 23
  • 76
  • 101
8
votes
1 answer

Does an OutputStreamWriter without buffering exist?

I need to convert a stream of char into a stream of bytes, i.e. I need an adapter from a java.io.Writer interface to a java.io.OutputStream, supporting any valid Charset which I will have as a configuration parameter. However, the…
Daniel Fernández
  • 7,335
  • 2
  • 30
  • 33
7
votes
2 answers

Do we really need to call flush() just before close() today?

I read this question Using flush() before close() , and the accepted answer is this only means you follow the pattern. Just like BufferedWriter#close() or FilterOutputStream.#close() , if all of buffered Stream/Writer will call its flush() when we…
JaskeyLam
  • 15,405
  • 21
  • 114
  • 149
7
votes
3 answers

Python csv writer : "Unknown Dialect" Error

I have a very large string in the CSV format that will be written to a CSV file. I try to write it to CSV using the simplest if the python script results=""" "2013-12-03…
SpikETidE
  • 6,711
  • 15
  • 46
  • 62
7
votes
2 answers

Spring Batch: Writing data to multiple files with dynamic File Name

I have a requirement to get the data from a database and write that data to files based on the filename given in the database. This is how data is defined in the database: Columns --> FILE_NAME, REC_ID, NAME Data --> file_1.csv, 1, ABC Data -->…
forumuser1
  • 71
  • 1
  • 1
  • 2
7
votes
3 answers

Libre Office Writer: Strike-out on delete rather than remove?

We occasionally see revision-suggestions for documents (usually from our attorneys) where removed content gets color coded and has a strike through it. Added content also gets its own color coding. I had always presumed that some specialty software…
mOrloff
  • 2,547
  • 4
  • 29
  • 48
6
votes
4 answers

Best free Excel writer for C# to output datatable to excel

I've got a console app that loads up a datatable; I'd like to export that to an Excel format and attach it to an email that's sent out on a regular basis. What is the best library to do so that I can pull down for free? I'm working for an academic…
Caveatrob
  • 12,667
  • 32
  • 107
  • 187
6
votes
3 answers

Are there OpenOffice.org export components for Delphi (non-OLE)?

For document exchange, I would like to generate OpenOffice.org text and spreadsheet documents. So far I have found export components which require OpenOffice to be installed, using OLE. Are there already Delphi components available which can write…
mjn
  • 36,362
  • 28
  • 176
  • 378
6
votes
8 answers

Adding The Date and Time to the File name

Hello I am trying to add the date and time to a file name in JAVA. I can get the date and time printed within the file, which I also want done, but when I place the toString in the FileWriter I get a Null Pointer. package com.mkyong; import…
Paul
  • 97
  • 1
  • 1
  • 3
5
votes
1 answer

Overwriting row in same csv file using dictwriter

I have names.csv first_name,last_name Baked,Beans Lovely,Spam John,Bang Harry,Potter I want to rename "John Ban" with "jason statham" in same file. I tried to use file.seek() but failed import csv with open('/home/tiwari/Desktop/names.csv', 'rw+')…
sujit tiwari
  • 274
  • 3
  • 14
1
2
3
30 31