Hi iam trying to read a file and write the contents into another file present in other directory.Iam using the following method
public static void storeFile(String fileName, String fileContents){ BufferedWriter writer = null; if (log.isDebugEnabled())log.debug("File name to store" + fileName); System.out.println("This is from FileOperations----storeFile()-----filename to store "+fileName); try { FileWriter fileWriter = new FileWriter(fileName); writer = new BufferedWriter(fileWriter); System.out.println(writer); writer.write(fileContents, 0, fileContents.length()); System.out.println("This is from File operations-----------------------4"); } catch (IOException ex) { System.out.println("This is from IOEXception==========="); ex.printStackTrace(); } finally { try { writer.close(); } catch (IOException ex) { System.out.println("This is from finally ------"); ex.printStackTrace(); } } }
iam getting the following output
This is from FileOperations----storeFile()-----filename to store D:/Australia/T
VETL/Transform/Transform/trunk/ETLFileStore/ETLOutputs/Output \CAPVOLMARKETDATA
HISTORICAL-11292011_11267.xml
This is from File operations-----------------------1
This is from File operations-----------------------2
This is from IOEXception===========
can anyone help me to solve this .....................?