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
-2
votes
2 answers

Scanner can't see integers, BufferedWriter can't write anything

Good evening! I need to read some integers and do mathematics with them, but my problem is not with algorithm. Scanner don't read int from .txt, and BufferedWriter don't write those ints either. When I try to write it in console, result is 0. What…
-2
votes
1 answer

BufferedWriter adds too many lines?

I wanted to ask if there is a better solution than using StringBuilder to cut some part of a String, which is parsed from a method through BufferedWriter to a file ? Without StringBuilder there is a bunch of much strings in the file, what happens…
loadP
  • 404
  • 1
  • 4
  • 15
-2
votes
1 answer

How to write the BufferedWriter out of main function

Now I use the sax parser to analysis the xml file(the following sample code comes from tutorialspoint). I want to output all the things to a txt file using the BufferedWriter when we call the characters function, while I don't get a way to make…
michael
  • 39
  • 7
-2
votes
1 answer

Why I am unable to get output while using BufferedWriter?

I am unable to get the output while using BufferedWriter. From my point of view it will show d aei durga [where i posted why no output particularly] import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import…
-2
votes
1 answer

How to check if the next line is empty with a BufferedWriter

I'm using a buffered writer to write words in a text file, which works. But the writer starts at a new line every time, so you get all the words underneath each other with output.nextLine(); Can I check if a line is empty with an if statement so it…
user4189129
-2
votes
2 answers

Read and Write to a File, An Arraylist which contains objects with an ArrayList

I have an ArrayList W1 containing Ward type objects and each Ward object have a Ward Name,Max Capacity,Current Capacity and an ArrayList P1 containing Patient type objects. Each Patient type object have a Name,Age,Address,gender..etc i want to write…
Mike
  • 11
  • 2
  • 6
-2
votes
1 answer

Using Two OutputStreams and BufferedWriters in Java

I was curious if anyone could help me understand what I'm doing wrong. I'm just learning how to use OutputStreams and BufferedWriters in Java and I'm not sure I'm doing it right. I know how to use one OutputStream and BufferedWriter but my problem…
-2
votes
1 answer

java- not able to write data to file using Files.newBufferedWriter

In a java program, I am copying some text line-by-line into a string variable. And then writing that data (again as text is retrieved line by line) into a second text file, using Files.newBufferedWriter For some reason, the writing stops at a…
Arvind
  • 6,404
  • 20
  • 94
  • 143
-2
votes
4 answers

Writing the text from the back

As in the tittle , i want to write my text from back and enter to the text file . In first , i read the text from the text file , next i want to save it in text file , but writing by the end of. I don't have any ideas how to fix my code . My code…
MOnasz
  • 99
  • 1
  • 2
  • 8
-3
votes
1 answer

Why bufferedReader is much efficient than Scanner class in java?

Have a look in the following question , no matter how much efficiently you write the solution for this , using Scanner class is resulting in the time out . Question : You have given an array , having  elements . Now for given  query you have…
-3
votes
2 answers

BufferedWriter outputting strange characters when saved to new file

I'm using the following code to process a large text file, line by line. The problem is that I'm using a language other than English, Croatian to be precise. Many of the characters appear as � in the output file. How can I resolve this? The file is…
Martin Erlic
  • 5,467
  • 22
  • 81
  • 153
-3
votes
1 answer

How do I end line when writing to a text file?

I'm writing to a text file but when I look into the file everything is in on line even though I'm adding "\n" in the string in the for-loop. What am I overlooking? File file = new File(dir.getAbsolutePath() +…
biz
  • 53
  • 6
-3
votes
2 answers

Writer not writing anything to file

public class AddDetails extends Application { private final String FileName = "C:\\Users\\marsh\\OneDrive\\Documents\\CustomPrograms\\CalcProb\\Players.txt"; private String Name; private char Hand1, Hand1; private double Skill1,…
-3
votes
2 answers

Java - Two buffered writers

Hello all ive been having issues with my BufferedWriter. at first i only had 1 buffered writer the 1 that is showed as cc and this worked perfectly along with the output but now that i have tried to implement 2 i continue to get an error else where…
-3
votes
1 answer

using Bufferdwriter why am I receiving main class not found or can't load?

I create a program that accepts user input. Based on the sales amount I am requesting the data go to either a low sales txt file or a high sales txt file. When I run the program I receive error Error: Could not find or load main class…
New2Java
  • 13
  • 1
  • 1
  • 8
1 2 3
50
51