Questions tagged [bufferedwriter]

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.

754 questions
3
votes
3 answers

Writing from Java to an XML document - Simple

I know there's tons of questions on writing from Java to XML on stackoverflow, but it's all too complex. I feel I have a very simple problem that I just can't figure out. So I have a program that takes a bunch of user input and I have it currently…
user2221125
  • 156
  • 1
  • 2
  • 17
3
votes
1 answer

write at once a second using bufferedwriter on android

I want to write gyro sensor values to file on sdcard. I prefer to use bufferedwriter but cant use it periodically. how it does?
Alper
  • 31
  • 1
3
votes
1 answer

scan.hasNext false when it should be true

So I'm a beginner at programming and I'm trying to figure out what the problem is with the following functions. The problem is with the scan.hasNext() method I have two println statements (one right after I make scan, and one on the second method)…
Luis Cruz
  • 29
  • 3
3
votes
3 answers

BufferedWriter.write() does not seem to work

I have two Java applications, where an Android client connects to a server on a computer and sends a message using BufferedWriter over websockets. The client: try { toast("Sending..."); Socket sock = new Socket(ip, PORT); …
Neko
  • 3,550
  • 7
  • 28
  • 34
2
votes
2 answers

Stream closed before the program finishes

I am using jetty server to receive calls from http clients. I am using BufferedWriter object to write a log file for debugging. The server is always running in order to receive calls. How can i tell the program to only close the stream…
Michael A
  • 5,770
  • 16
  • 75
  • 127
2
votes
2 answers

What is memory effects of bufferedwriter close() & flush() methods?

I am quite confused here. I am preparing to SCJP, I wrote a small recursive to check BufferedWriter memory allocations before|after flush() & close() methods. Please see below code block, I have just wrote my Desktop files into a text file. import…
HRgiger
  • 2,750
  • 26
  • 37
2
votes
3 answers

BufferedWriter and socket in java, write has no effect

I'm writing a small client application to communicate with a server. I open a socket between my client and the server and can read anything that goes out from the server with a BufferedReader. This is read in a thread. However, when I write on the…
rmonjo
  • 2,675
  • 5
  • 30
  • 37
2
votes
1 answer

Is there a pattern for re-using a BufferedWriter?

I am reading XML files from a directory (containing thousands of files), processing the content and writing one output file for each input file. Is there a way of 're-pointing' an existing BufferedWriter instead of creating a new instance for each…
REardley
  • 21
  • 2
2
votes
2 answers

BufferedWriter doesn't send text unless stream is closed

I have a server that communicates with a client. The server is multithreaded, and this thread is created with the socket and a bufferedreader connected to the socket, when the first line read from the socket is "request": public class scriptComm…
Mike Haye
  • 793
  • 3
  • 12
  • 22
2
votes
1 answer

How to convert 'io.BufferedWriter' to 'Dataframe' - Python

I am downloading files from One Drive with the following piece of code: if response.status_code == 200: print('\n> Response Success') with open('Book2.xlsx', 'wb') as File: File.write(response.content) print('\n>…
zsh_18
  • 1,012
  • 1
  • 11
  • 29
2
votes
0 answers

Reading from & writing to network stream simultaneously

public class twowaychat { ServerSocket server; Socket socket; BufferedReader read; BufferedWriter write; String temp, temp1; twowaychat() { Thread thread1 = new Thread("Read-Client") { public void…
2
votes
3 answers

How to write or store string array in .txt file in java

I want to write string array in .txt file. But after running my code, I am getting an empty file. Here is my code. public void DataSave() throws IOException { File fout = new File("Data.txt"); FileOutputStream fos = new…
Ferdousi
  • 319
  • 5
  • 17
2
votes
3 answers

How can I split a CSV file into different CSV files by line in Java?

I have a class which reads a CSV file but when size of file is high, the program throws Java heap size error, so I need to split that file into pieces and transfer lines to other files according to line size. For example; I have a file of 500 000…
Bora Ulu
  • 33
  • 1
  • 6
2
votes
0 answers

BufferedWriter seem to not working inside for loop

I have this code to check for some largest palindrome stuff (problem) This is part of my code: public static void main(String[] args) throws IOException { BufferedWriter out = new BufferedWriter(new FileWriter("./out")); for(int…
Adil Saju
  • 1,101
  • 3
  • 12
  • 26
2
votes
2 answers

Buffer in FileWriter and BufferedWriter

The api of FileWriter begins with these words: "Writes text to character files using a default buffer size." The api of BufferedWriter begins with these words: "Writes text to a character-output stream, buffering characters [...]" So, obviously both…
mrbela
  • 4,477
  • 9
  • 44
  • 79