problem with file creation
hey...
While i am trying to copy a file from a folder to another folder, the new file is being created but with an info different from the original one...
eg:
the file hello.txt in a directory contains "gayatri"
and i am creating a new file hi.txt in another directory...
the file is created but the contents are being displayed as
udfhuahsd
sadfhidasdf
asdfuhasidfh
asdfhsiaisadf
asdfhioashdf
asdfhioasikss:w
\
can anyone help me on this issue...please
i will be waiting!
the code goes like this...
try {
jfw.connectAndLogin("10.238.118.7","cts122416","k122416");
System.out.println(jfw.getSystemName());
System.out.println(jfw.getRemotePort());
System.out.println(jfw.isConnected());
//System.out.println("HOLLA"+jfw.ascii());
jfw.changeWorkingDirectory("C:\\ftpsite\\load\\");
jfw.downloadFile("hello.txt","C:\\ftpsite\\download\\hi.txt");
jfw.binary();
jfw.disconnect();
actually, this code is written in some jakarta wrapper class where this method "downloadFile" is being called from another ftp.java.
try {
jfw.connectAndLogin("10.238.118.7","cts122416","k122416");
System.out.println(jfw.getSystemName());
System.out.println(jfw.getRemotePort());
System.out.println(jfw.isConnected());
//System.out.println("HOLLA"+jfw.ascii());
jfw.changeWorkingDirectory("C:\\ftpsite\\load\\");
jfw.downloadFile("hello.txt","C:\\ftpsite\\download\\hi.txt");
jfw.binary();
jfw.disconnect();
//jfw.uploadFile("C:\\hello.txt","C:\\ftpsite\\load\\");
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
this is the ftp class...and the downloadFile method which is written in jakartawrapperclass...that code goes like this...
public boolean downloadFile (String serverFile, String localFile)
throws IOException, FTPConnectionClosedException {
FileOutputStream out = new FileOutputStream(localFile);
System.out.println("Local file path"+out.getChannel());
boolean result = retrieveFile(serverFile, out);
System.out.println("Result is "+result);
out.close();
return result;
}