Adding extra control charcters in a ZIP file.
I am creating a GZip file in linux by a java program. After Unzipped(by using gunzip command) the file in linux i am getting the file with the correct data. I ftped the file from Linux to Unix in binary mode. After unzipped(by using gunzip command) the file in Unix i am not getting the file with correct data. The control character(^M) is adding at every end of line. I am not able to find why its happening. Anyone can help me ?
Plz..........
Thanks
I implemented the dos2unix command in java.
The implementation of this command is,
public void dos2Unix(String dosFileName){
File dosFile = new File(dosFileName);
File tempFile = new File(dosFile.getAbsolutePath() + ".tmp");
try
{
BufferedReader in = new BufferedReader(new FileReader(dosFile));
BufferedWriter out = new BufferedWriter(new FileWriter(tempFile));
int c;
while((c = in.read()) != -1)
{
if(c != '\r')
out.write(c);
}
in.close();
out.close();
dosFile.delete();
tempFile.renameTo(dosFile);
}
catch(IOException e)
{
throw new RuntimeException(e.getClass() + e.getMessage());
}
}
Now its working fine
Thanks a lot