Questions tagged [filewriter]

Java built-in class that allows writing character files.

Public class FileWriter extends OutputStreamWriter.

Convenience class for writing character files. The constructors of this class assume that the default character encoding and the default byte-buffer size are acceptable. To specify these values yourself, construct an OutputStreamWriter on a FileOutputStream.

Whether or not a file is available or may be created depends upon the underlying platform. Some platforms, in particular, allow a file to be opened for writing by only one FileWriter (or other file-writing object) at a time. In such situations the constructors in this class will fail if the file involved is already open.

FileWriter is meant for writing streams of characters. For writing streams of raw bytes, consider using a FileOutputStream.

Since: JDK1.1

Source: Oracle

1133 questions
-4
votes
2 answers

How to write a file comfortable and easy?

I'm pretty new in developing C#, and my problem is to write a text file. I found some solution with StreamWriter lik this... StreamWriter file = new StreamWriter("C:\Downloads\test.txt"); file.WriteLine("this is line…
prototype0815
  • 592
  • 2
  • 7
  • 24
-4
votes
1 answer

How can I write a list of random generated numbers to a file?

This is what I have so far. I am having issues with getting the File Writer to work. import java.util.Random; public class Sort { public static void main(String[] args) { Random rand = new Random(); int q = 10000; for (int i = 0;…
Courtney
  • 19
  • 2
-4
votes
1 answer

How to write a csv file having "|" as a delimiter

for example if i want to write data into csv file FileWriter fw = new FileWriter("C:\\output\\delimited.csv"); fw.write("hi"); fw.write(","); fw.write("hello"); fw.write(","); fw.write("working"); …
Manoj Krishna
  • 347
  • 1
  • 4
  • 12
-4
votes
1 answer

how to download server side file javascript

We developing web sit.we have two textFiles in server http://192.168.3.134:8080/Helphands/forTest1.txt and http://192.168.3.134:8080/Helphands/forTest2.txt .We need is When we button click we need download forTest1.txt file and then count 1 write…
Pavan Alapati
  • 267
  • 3
  • 5
  • 15
-4
votes
1 answer

File Name defined by user in Java

I got questions about creating files in Java. I searched for some time and couldn't find way to save file with name defined by user (like you can in almost any other program). Everywhere I look file name is defined in new File("something.sth") or…
Allspark
  • 5
  • 2
-4
votes
1 answer

Writing a file using for loop. But I am not able to do it

I have to write some data to files. I tried to write data to files using loops. But When I used this code it writes just one line per file. help me with this code Vector[] v = jca.getClusterOutput(); for (int i=0; i
Samantha Cool
  • 69
  • 1
  • 10
-5
votes
1 answer

Does Java's FileWriter object attempt to create a file if file does not exist?

I am seeking to clarify what the Java API documentation states about the FileWriter class. The documentation states the following: constructor: Constructs a FileWriter object given a file name. public FileWriter(String fileName) throws…
user1690442
-5
votes
3 answers

Java FileReader and FileWriter copy a textfile on another

i try to copy the content of a file created in eclipse to other one and it gives me an error here is the code package applitfichiertext; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import…
Sunset
  • 9
  • 2
1 2 3
75
76