Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Loss of data in writing large String to a file

$
0
0
Hello,
I have approximately an 8Mbyte string I want to write to the hard drive. In doing so approximately the last 100 characters is not getting written. I am debugging in NetBeans and on the final write, I can check the variable, and it does contain all of the data. I then view the file with notepadd++ and the last (approximate) 100 characters are missing. I also have read the data back in to confirm that notepadd++ is displaying the same thing.

 java.io.File testFile;
 testFile = new java.io.File(FilePathName);       
 java.io.FileWriter FW = new java.io.FileWriter(testFile);
 java.io.BufferedWriter BR = new java.io.BufferedWriter(FW);
 String temp = getFaxFileData();     //at break point all data is in this string
 char[] fullfile = temp.toCharArray(); // all data is in this character array
 BR.write(fullfile, 0, fullfile.length);     //break point inserted here


I have also tried writing just the string, and not using a buffered writer:
 
FW.write(temp);//tried this
BR.write(temp); //and this


and the same truncation occurs. I have no bizarre character values, they are all a-z 1-0 and !@#$%^&*())_+=-. Any help is appreciated as this is a strange issue. As I said before I have also read the data back in to make sure it wasn't some strange OS thing with how I was viewing the data, and the data read back in was consistent with what was viewed in the file. Thank you in advance.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>