760 questions
0 votes
2 answers
95 views
How to efficiently flush and write large amounts of data to a file using BufferedWriter in Java? [closed]
I'm working on a Java project where I need to write a large number of lines to a file. I know BufferedWriter can improve performance compared to writing character by character, but I am unsure about ...
2 votes
2 answers
78 views
BufferWriter still write in a file that doesn't exists anymore
I'm writing via BufferWriter to a file. If I delete this file from the windows file system while the BufferWriter is still writing, the program doesn't report any error. Where does the BufferWriter ...
2 votes
2 answers
119 views
Writing and returning a File in Kotlin using a buffer
I'm working on a function to process some data and output the results as a csv file. I am using a 'use' block to wrap the function and ensure all the resources are closed. the problem I am running ...
-4 votes
1 answer
66 views
Read complex CSV having custom delimiter and insert into database using PreparedStatement in java
I've googled around multiple options and still clueless on which is the best way to save data from csv file into database. I tried using: BufferedReader lineReader = new BufferedReader(new FileReader(&...
0 votes
0 answers
17 views
Beginner Java question on importing bufferedwriter in module-info.java
I am pretty new to java and I am trying to import some classes into my Java project, particularly java.sql and java.io.FileWriter + java.io.BufferedWriter In my module-info.java, I have added the ...
1 vote
1 answer
84 views
From memory buffer to disk as fast as possible
I would like to present a scenario and discuss suitable design patterns to address it. Consider a simple situation: a camera records to a memory buffer for ten seconds before stopping. Once recording ...
0 votes
2 answers
166 views
How to use try-catch (IOException) for BufferedWriter.write nested in if-else?
I have a block to write data(string) using BufferedWriter, but compiler keeps saying error: unreported exception IOException; must be caught or declared to be thrown this.dataContainer.stream()....
0 votes
1 answer
109 views
How to use BufferedReader and BufferedWriter to interact with a process's console using processBuilder
I have built a game of text based BlackJack and am coding a bot to play the game and record the results. I have successfully launched the game and read the initial data from the console however once ...
0 votes
0 answers
59 views
How to split a string in java when there is a new line character?
I'm trying to write a large String that I have into a txt file, in said string there are a lot of \n and I'd like that to register as a new line in my txt file. I've tried to split the string whenever ...
0 votes
0 answers
134 views
Python os.fdopen() gives OSError: [Errno 9] Bad file descriptor
I am trying to test out a virtual serial connection in python with individual funtions for each test. ''' Testing Virtual Serial Port Connections ''' import os import sys import time import serial ...
0 votes
2 answers
170 views
Why won't my client nor server send messages to each other?
For my networking course, I am tasked with turning a OneWayMesg (Client sends messages to Server) program to a TwoWayMesg (Client sends messages to Server and Server sends messages to Client). In ...
0 votes
1 answer
133 views
Why my code showing error: unreported exception IOException; must be caught or declared to be thrown at bw.write(s); [duplicate]
Problem Statement: Given an array of integers, answer queries of the form: [i, j] : Print the sum of array elements from A[i] to A[j], both inclusive This is the code I used: import java.io.*; import ...
0 votes
0 answers
35 views
Can I write only in certain lines in a file with BufferdWriter without overwrite others?
I want to save a highscore in a database, but if an sql-exeption is thrown I want to temporary save the data in a file. The game has diffent modes and for each there is a highscore. I would like to ...
1 vote
1 answer
1k views
Passing a BufWriter to a function in Rust
In this example I'm trying to pass a BufWriter to some functions but don't understand generic type syntax enough to figure out whats missing. Instead of passing the file, I want to pass the buffered ...
0 votes
1 answer
181 views
How can I write to a file using BufferedWriter if the input type is double?
I am trying to write to a file using BufferedWriter. As the write method takes int argument, I am casting input of double type into int type but it is not being written properly into the file. try{ ...