All Questions
15 questions
1
vote
1
answer
398
views
How PrintWriter can write to byte stream, but BufferedWriter cannot?
To start with I will provide a piece of code with comments:
FileOutputStream fos = new FileOutputStream ("test.txt");
//fos IS-A OutputStream as FileOutputStream extends OutputStream
...
0
votes
1
answer
535
views
Can we use two buffered writers to write on the same file with java, in the same class?
I have been wondering if I cam use two bufferedWriters to write an external file with java.
This is what I did:
But there is only written X in my created file, any ideas ?
It seems like the file ...
0
votes
5
answers
68
views
Write and close BufferedWriter in single line code snippet
I've below code snippet.
Map<String, Object> globalMap = new HashMap<String,Object>();
File talendLogFile = new File("C:\\Softwares\\logFiles\\error.log");
Writer talendLogFileWriter = ...
-1
votes
2
answers
36
views
See size and the content of file (the new added strings) while writing to it in java after each refresh
I have used PrintWriter to write to a text file with java, the process takes time, bcz there is an iteration process, at end of each iteration, a string is appended to the file, if I wait till the ...
0
votes
2
answers
2k
views
BufferedWriter without try method IOException
I know this topic has been discussed a lot and I have already read a lot of posts here about that, but I still seem to have trouble.
My problem is that I am also a beginner and I don't really ...
0
votes
1
answer
654
views
BufferedWriter does not write to file after flush and close
I have following sample application in which I write to a file and immediately after closing the writer, I try to read from the file but to my surprise nothing is written to file.
I have made sure ...
0
votes
1
answer
199
views
write() method not recognizing TextArea
I've written an ActionListener for a toolbar menu item which is called "Save", on click I want the program to save the content of TextArea l1 into a .txt file called "filename", so this si the code ...
-1
votes
1
answer
302
views
Why won't the BufferedWriter instantiation write to a txt file in Java?
I am trying to instantiate a object with BufferedWriter and it wont work. The problem happens when I use the write function. Why won't it let me write to the file?
The error is cannot find symbol. ...
1
vote
5
answers
585
views
BufferedWriter not writing ALL the information
I am making a simple tutorial program in which the user inputs some data, then that data is written into a textfile, then the textfile is read and the data displayed. However, not all of the data is ...
0
votes
5
answers
972
views
One file writer for multiple classes (fast)
I am working on a heuristic which aims at a short runtime/calculation time. To retrieve the results, I need to write them to a file.
The writing is done by different classes, but they should all write ...
7
votes
2
answers
5k
views
Do we really need to call flush() just before close() today?
I read this question Using flush() before close() , and the accepted answer is this only means you follow the pattern.
Just like BufferedWriter#close() or FilterOutputStream.#close() , if all of ...
0
votes
1
answer
926
views
Error writting a txt file String index out of range
Can someone explain me why I get: java.lang.StringIndexOutOfBoundsException: String index out of range: 5
File file = new File("file.txt");
BufferedWriter writer = null;
Date date;
...
0
votes
3
answers
3k
views
What is the consequence of not closing a BufferedWriter
Suppose I have a BufferedWriter that has written 5000 rows (some of which are not yet flushed).
What are the consequences if I do not close() this instance at the end of my program?
0
votes
2
answers
1k
views
Weird FileWriter error
I have written to files before and never come across this problem, i am utterly confused.
EDIT: Sorry the error is that no lines are being written to the .txt file.
System.out.println(upto);
...
1
vote
2
answers
2k
views
Buffered Writer Java Limit / Issues
I have a buffered writer that is writing to a text file. For some reason the writer stops writing a long string about half way through. Are there any known issues with using the buffered Writer in ...