Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
51 views

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 ...
Ahamed Shahif's user avatar
2 votes
2 answers
78 views

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 ...
MaxSan's user avatar
  • 51
2 votes
2 answers
119 views

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 ...
pbuchheit's user avatar
  • 1,839
-4 votes
1 answer
65 views

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(&...
Meenal's user avatar
  • 147
0 votes
0 answers
17 views

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 ...
kaushyy's user avatar
  • 11
1 vote
1 answer
84 views

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 ...
rober_dinero's user avatar
0 votes
2 answers
165 views

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()....
limestreetlab's user avatar
0 votes
1 answer
109 views

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 ...
Damon's user avatar
  • 1
0 votes
0 answers
59 views

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 ...
P.noulis's user avatar
0 votes
0 answers
134 views

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 ...
Paul Bernard's user avatar
0 votes
2 answers
170 views

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 ...
ali's user avatar
  • 1
0 votes
1 answer
133 views

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 ...
Charan Guvvala's user avatar
0 votes
0 answers
35 views

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 ...
Cedric's user avatar
  • 1
1 vote
1 answer
1k views

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 ...
Ross Youngblood's user avatar
0 votes
1 answer
181 views

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{ ...
Amit Sur's user avatar
0 votes
1 answer
87 views

I'm trying to make BufferedWriter write into txt file in format "latin - cyrillyc",and cyrillyc part is not working(hieroglyphs instead of text),neither do special symbols like ą ł ó ę etc. ...
ouzhizus's user avatar
0 votes
1 answer
363 views

So I'm trying to use the BufferedWriter Class to create and write to a text file. However, a file is never created, nor is any error generater. However, if I create a text file and specify its path, ...
Sanjay Chunduru's user avatar
0 votes
1 answer
670 views

I'm writing to a file and I need to escape some characters like a quotation mark. File fout = new File("output.txt"); try (FileOutputStream fos = new FileOutputStream(fout); BufferedWriter ...
Ayo K's user avatar
  • 1,784
0 votes
0 answers
89 views

Just wondering if my bufferedWrites will work outside this try clause as it should as. i atm have no way of checking the outcome atm but. As in i only need the stream to be open for the instantiation ...
Mr.Gomer's user avatar
  • 631
0 votes
0 answers
43 views

I am experimenting with java by building a commandline game. I want to save user progress to a file , and am using buffered writer as shown below but it does not write to file.What might be the issue? ...
louis's user avatar
  • 832
0 votes
0 answers
99 views

I am trying to write a huge output file the quickest possible on two different files. I have created my lists list1 and list2, and I am now trying to write those in a respective file. I started to ...
Vitaky's user avatar
  • 1
-2 votes
2 answers
211 views

I noticed that if I don't call myBufferedWriter.close(), my content will not appear in the target file. What if the program ends accidentally before reaching myBufferedWriter.close()? How to avoid ...
John Smith's user avatar
0 votes
1 answer
435 views

I am working on a game and I want to store the High score in a file and read it whenever it's needed. I wanted to use BufferedWriter and BufferedReader like this on the gameover class. File fi ...
Newbie_programmer's user avatar
1 vote
0 answers
32 views

I am new to file handling in Java. My input file is a csv file with a number of columns. My objective is to create a new file each time I encounter a different value in the input .csv file and append ...
Shyam Deshmukh's user avatar
0 votes
1 answer
180 views

I have made a bufferedWriter to take an arraylist of things and comma separate them. It works well, but when I retrieve the data it starts adding extra brackets: [banana, potato, tomato, carrot] goes ...
horribly_n00bie's user avatar
1 vote
1 answer
48 views

I'm writing and reading from a file and it works perfectly fine. However when the activity is switched or the app is closed it appears that the file is deleted or some such as null is returned when ...
jake.ward2639's user avatar
1 vote
1 answer
1k views

I am trying to write a json file using this code: File f = new File("words_3.json"); if (!f.exists()) { f.createNewFile(); } if (fileWriter == ...
Muhammad Bappi's user avatar
0 votes
1 answer
407 views

I am a first-year programming student and I was tasked to make a Login and Register program using Java Swing (Application Window) and BufferedReader+Writer. I am now able to write a username and ...
Alice Cherry's user avatar
0 votes
2 answers
342 views

I have a txt file called employees.txt which contain employee id and names. Their id starts with either 18,19 or 20. And have to look within the file if the line starts with 18 it needs to go to ...
Shawzz's user avatar
  • 35
-2 votes
1 answer
57 views

Currently trying to edit my old code from System.out.println() statements that display the results of a benchmark test to writing the results to 2 different .txt files. I am doing this so I can create ...
GhostRider's user avatar
0 votes
2 answers
446 views

I'm currently in (1st year) college and was assigned to do Java Server. Currently, I have created a really simple HTML page (Hello world style) and text shows up in the Localhost. However, when I ...
Luís Soares's user avatar
0 votes
1 answer
658 views

I created this program where it takes an input from one text file where students grades and names are recorded like this: lastName:firstName:Test1:Test2:Test3 After this the program reads them and ...
Origon09 _'s user avatar
0 votes
1 answer
121 views

so my task is to make an external merge sort with a text file. I'm also supposed to only have a maximum of 3 Strings at one time. This is what my merge-Method looks like: public static void ...
bruh1667's user avatar
1 vote
1 answer
63 views

I'm trying to read the text contents off of a given URL, then print the contents, as well as write it to a text file using BufferedWriter. I need to include a code block that allows only 35 lines of ...
Dani's user avatar
  • 13
0 votes
1 answer
468 views

I am trying to read value received from JavaScript WebSocket using Java I have this JavaScript code: const socket = new WebSocket("wss://localhost:7999"); // start socket.addEventListener(&...
user7289922's user avatar
0 votes
1 answer
771 views

I have a method called "add" which takes a string as an argument and uses the bufferedwriter to write it to the file. Once this is done, the bufferedwriter is flushed. In another method &...
Mohamed Yehia's user avatar
1 vote
1 answer
86 views

I have a java application that reads and writes csv files. I have created a read only directory on my Mac that my application will try to write a csv file to. I did this with chmod 000. No file gets ...
iansumm's user avatar
  • 31
0 votes
2 answers
154 views

I have Server-Client messenger - not important - and I have a settings file to store the settings, but for some reason when I run the code, the settings file clears. Here is the code that makes the ...
Monte Scott Barber's user avatar
0 votes
0 answers
35 views

I have made tried to make a client server messenger using sockets, but it seems to not be sending/recieving messages. I am using a BufferedWriter and BufferedReader if that helps at all. Everytime I ...
Monte Scott Barber's user avatar
0 votes
0 answers
104 views

I am trying to make an action listener for a button to send a message from a server to client and vice versa, but I can't access the bufferedwriter variable from the thread, so I can't send a message. ...
Monte Scott Barber's user avatar
-1 votes
1 answer
254 views

I converted a text file content to a byte array. I want to rewrite it into another text file but BufferedWriter writes it all in one line how can I fix it? I want that to be exactly like its original ...
hamid's user avatar
  • 9
0 votes
1 answer
652 views

I am receiving data from a stream and writing the result to a file File resultFile = new File("/home/user/result.log"); BufferedWriter bw = new BufferedWriter(new FileWriter(resultFile)); ...
Thomazzz's user avatar
  • 203
0 votes
1 answer
789 views

I have a method where I save all data by packing together images and annotations in csv format associated with them. I use CSVPrinter to print to the CSV which I'm trying to append to the zip file, ...
Jack Avante's user avatar
  • 1,665
0 votes
1 answer
114 views

I have PVPStats objects stored in PlayerMeta.java: public static Map <UUID, PVPstats> sPVPStats = new HashMap<>(); I know for sure the map is getting populated with objects that contain ...
DogeCode's user avatar
  • 381
1 vote
1 answer
2k views

I'm new to java and I want to ask what's the difference between using FileReader-FileWriter and using BufferedReader-BufferedWriter. Except of speed is there any other reason to use Buffered? In a ...
Maria's user avatar
  • 13
0 votes
2 answers
1k views

A logic that handles the rollback of a write to a file is this possible? From my understanding a BufferWriter only writes when a .close() or .flush() is invoked. I would like to know is it possible to,...
user3111115's user avatar
0 votes
1 answer
601 views

In my use case, i would like to use a buffer writer to handle the storing of strings. Only when the commit interval has been met, it will flush the writes This is to ensure that when there is a ...
user3111115's user avatar
0 votes
1 answer
129 views

Im using this code in order to write some text to a file, while limiting the size of the file to 1G but every time a new text is entered, its overriding the current file content. How do I disable the ...
Tal Levi's user avatar
  • 915
0 votes
1 answer
143 views

I have these three methods and I am trying to write the contents of three lists to a file using the buffered writer. First Method: To Save File: public static String showSaveDialog() { ...
Student's user avatar
  • 124
-4 votes
1 answer
158 views

So basically I have a file that the java code reads from and writes to. BufferedReader works BufferedReader bReader = new BufferedReader( new InputStreamReader( ...
Arlindi Frakulla's user avatar

1
2 3 4 5
16