I am trying to copy an xml file of 13KB to new file using File readers, BufferReader and FilerWriter. But its only copying 8kb. There is no logic just read each line from one file and copy it newly created file.
Can anybody let me know, is there size limitation for copying file while using File Readers. I have even tried giving size of FileReader and writer.
No, of course there isn't a limitation on the size of the files you can copy.
When you look at the output file, is it the same as the input file only with some data at the end missing? If so, then most likely you aren't closing your output writer.
But you would be better off copying the file using InputStreams and OutputStreams. If you don't plan to do anything with the data except copy it, there's no point in converting the bytes to chars and then back to bytes. And if you don't use the right charset for your Reader, you could even corrupt the data.
Wow!that was pretty fast. you are right i was not closing the file. Actually i wast testing code and once i finalize I thought of closing and setting it null. But, I never thought it would cost me a day.
It also seems quite possible that you're not copying the file correctly. One common error would be failing to check the return value of a read(char[]) call to verify how many chars were really read. If you show the code you used to copyy the file, we can help identify possible problems.
There are also certain obscure circumstances where files can't be copied with streams/readers/writers, e.g. Macintosh OS 9 files having resource forks. Trying to copy those with the java.io classes will result in truncated files.