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
-2
votes
1 answer

Can't write number with FileWriter

This is my code and I want b[i] will be write to the file name test.txt but it is not working. It's just write something like symbols. Thanks for helping. public class btl { public static boolean IsPrime(int n) { if (n < 2) { return…
Ngo Hoang
  • 17
  • 4
-2
votes
1 answer

no suitable method found for write(object) error in MultiDimensional Vectors in java

I am using multidimensional vector. Whenever I wanna write the elements in a file, write() gets error saying "no suitable method found for write(object)". Can you tell me how should I convert Integer object to int so that i can put that in file.…
-2
votes
1 answer

Java Directory Search - Text File Writer - Only 1 result appears

Hey so I'm currently having an issue with this code: [There is more code to this but this is the block that I need help with] File fe = new File("C:\\Users\\" + System.getProperty("user.name") + "\\desktop" + "\\SearchResults.txt"); String…
harry
  • 7
  • 1
-2
votes
1 answer

Java Overwrite file

public void saveList(Vector table_data){ ArrayList output_list = new ArrayList(); for(int i=0;i
-2
votes
1 answer

How to write in a file with threads?

How to write in a file with threads ? Each file should be 100 lines, each line length is 100 characters. This work must perform threads and I\O. My code: public class CustomThread extends Thread{ private Thread t; private String…
Valeriu
  • 171
  • 1
  • 1
  • 11
-2
votes
3 answers

During writing into text file splitting into a new file after Nth Rows in java?

Suppose I have 105 records and I want write all records in text files where in each file there will be 10 records. so total file will generate here 11.
Avijit Das
  • 52
  • 4
-2
votes
1 answer

How to write text file in java

I am new to java and I am writing coding for automation in Selenium. I want to know is it possible to write a text file throughout the java program till end of the program. I have tried to write a text file using bufferedWriter.write(). First three…
Dina
  • 11
  • 2
-2
votes
1 answer

Three nested Object to file *.txt in C++

i want write an Object to file (*.txt) class MyCircle{ double x; double y; double radius; char index; int check;} class Question{ int index; int quantityOfAnswers; MyCircle [] arrCircles; …
Jetly_93
  • 11
  • 5
-2
votes
1 answer

FilenotFoundException in Android using FileWriter

I am new to java and android developement I am writting one xml file to my RSS feed Well my main probelm is that I am not able to execute statement as FileWriter writer = new FileWriter("/webfeederiter.xml"); I am getting exception as…
-2
votes
3 answers

Java writes writes line multiple times?

static void goOut(String in) { //instance variables String fileCopy = currentLine + in; try { FileWriter writer = new FileWriter(output,true); writer.write(line1 + System.getProperty("line.separator",…
Adz
  • 2,809
  • 10
  • 43
  • 61
-2
votes
1 answer

EOFException when obtaining a Writer object on serilized file

I am getting following: java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source) at…
Twaha Mehmood
  • 737
  • 3
  • 9
  • 26
-2
votes
1 answer

How to store data in a file called questions.list

I am currently tring to store data in a file that is going to be called questions.list (a file object)However i am unable to this, i suspect there a few problems/missing parts in my code(as i have a very basic knowledge on objects). Could anyone…
-2
votes
5 answers

important points when you write any file

I am writing a file which is very important for the application (Client & vendor specific). I would like to know what are the point should i consider at writting the file. Please see below a demo file writing process public class EDIWriter { …
user1010399
  • 2,258
  • 5
  • 30
  • 42
-2
votes
3 answers

Delete random space in FileWriter

I have this list of array string that I want to write in a file, but in a manner that there will be no space between them and no return to line. So, I tried to use a StringBuilder to that to make it all one unified string. However, I still get some…
rima101
  • 43
  • 1
  • 7
-2
votes
3 answers

How to get output like this in java using forloop to a text file?

I must get output like this in java digraph G { main -> parse -> execute; main -> init; main -> cleanup; execute -> make_string; execute -> printf init -> make_string; main -> printf; execute ->…