Java class for writing text to a character-output stream, buffering characters so as to provide for the efficient writing of single characters, arrays, and strings.
Questions tagged [bufferedwriter]
754 questions
1
vote
1 answer
Writing in same file from different classes in java
How do I write in same text file from different classes in java.
One of the class call method from another class.
I do not want to open BufferedWriter in each class, so thinking if there is a cleaner way to do this ?
So essentially, I want to avoid…

Andy897
- 6,915
- 11
- 51
- 86
1
vote
4 answers
Program design when using BufferedWriter, do I repeatedly open and close file?
I have a program that does a lot of processing with loops and writes strings to a file at many different points. I'm not sure about the overall design for how best to do this. I won't need to read from the file at any point during running, though…
user10724876
1
vote
1 answer
Is there a reason why the BufferedWriter writes sumbols instead of numbers?
I am trying to write to a file a 2 dimensional array from numbers, but it only writes (SOH) for 1, (ENO) for 5 and a blank space for 0(NUL).
I got those letters from NotePad++
int[][] array= new int[][]
{
{ 1, 1, 1, 1, 1, 1, 1, 1,…

Lachezar Tsvetkov
- 19
- 6
1
vote
1 answer
How to filter text file and save the result to the new file by java
Hello my question is how to filter text file by column, I mean that I want to cut file from range between rows.
My files are with this kind of data:
284015160747447;8935901990807474474;
284015160747448;8935901990807474482;
…

Liverpool
- 265
- 7
- 21
1
vote
1 answer
Write URL data to file is empty
I am trying to get data from URL and write it to a file, and I got the data from the URL but the file is empty, and below my code:
public class LiveRead {
public static void main(String[] args){
try {
URL u = new…

Fzee
- 33
- 6
1
vote
3 answers
Is it possible to get the contents of a BufferedWriter as a String?
So, I we have operations that are writing to a file on a server using a BufferedWriter. Before that BufferedWriter is flushed, I want to upload the contents to an S3 bucket. Currently (and inappropriately) I am collecting each string that the…
user8072194
1
vote
0 answers
BufferedWriter and printing name and duration entered by user on JTextArea
This function says that if the button "generate report" is pressed a text file will be generated. It will have the title from label1, date&time, and Activity name & Activity duration which was entered by the user in jTextArea in the form…

Ayaan
- 45
- 1
- 5
1
vote
4 answers
Can I write FileWriter and bufferedwriter in a same class in Java?
Here is the code, in which I'm trying to write using Filewriter. This is working fine.
File f2 = new File("Path");
f2.createNewFile();
FileWriter writing = new FileWriter(f2);
writing.write("i'm into you , i'm into you");
writing.flush();…

sharan shetty
- 23
- 6
1
vote
0 answers
Send output from Java programm to Python process using input()
thank you for helping
I'm trying to write and read characters from a Java process to a Python process.
While the other way(print from python and get it in the Java process) is working fine, the Python process seems not to get the output of the Java…

NyuB
- 93
- 7
1
vote
4 answers
Can I write in the same socket using bufferedwriter and having threadsafe?
I have a client use a bufferedwriter for write in a socket. But client create a thread that can use the same bufferedwriter. I don't use lock for it and my program doesn't have problem, but have I a problem if the main thread of client and the…

Ecila
- 57
- 1
- 4
1
vote
2 answers
FileNotFoundException problem
I've just finished reading 'Java for Dummies' and have begun to create a simple POS program. I have been having trouble getting the program to do what I want it to do! I have two actionListeners linked to each of the following buttons, 'Amigos' and…

LtBL
- 13
- 1
- 2
1
vote
1 answer
Using OutputStream, OutputStreamWriter and BufferedWriter interchangably
I am using Java (Android) to attempt to upload a file to a web server, using HttpURLConnection as recommended. I have had difficulties sending data as a POST request in the past but successfully achieved it after a few hours. This data was simple…

Patrick Sturm
- 393
- 1
- 13
1
vote
1 answer
Adding number of lines with BufferedWriter/Reader
Please help me with adding number of lines of original file.
Im trying to write lines which met specified conditions from file A to file B. There is no problem, but I need to write number of lines of file A to the end of file B and also add number…

romanzdk
- 930
- 11
- 30
1
vote
3 answers
Java - newline option is not working as expected When running program on Linux
I have an application where I want to write a string to the file as newline at EOF.
My program executes on Linux OS and the file that I want to to write resides in a windows shared folder.
Problem: I am able to add string to the file as a newline,…

jeevan
- 21
- 5
1
vote
1 answer
Java appending to text file working differently on another system?
When I run the below on a windows machine it works as expected, appending to the end of the text file on a new line, however when run in a jail on my FREENAS server inputs will simply append to the last line and never make a new line. Has anyone…

user7466895
- 319
- 1
- 6
- 14