vinoth vino wrote:...then I copied this to files using FileInputStream but I've only the empty text file. There were no contents in that file. Please anyone help me out.
Well, let's look at your code.
Line 29. You created an output file, which starts off as an empty file.
Line 30. You created an byte array output stream, which starts off as an empty byte array.
line 31. You get the byte array, which is an empty byte array.
line 33. You write the empty byte array into the byte array stream, which means that it is still an empty byte array.
line 34. You write the empty byte array stream into the file, which means that it is still an empty file.
The output looks like it is correct to me.
Henry