java.io.File.getCanonicalPath() exception in C#.net....
HI
i have create a project having VSJLIB reference in it
when i have code it as follows
Code:
<pre> public void CreateZipFile(string sPath)
{
FileOutputStream stream1 = null;
ZipOutputStream stream2 = null;
if (System.IO.File.Exists(sPath))
{
FileInfo info2 = new FileInfo(sPath);
stream1 = new FileOutputStream(sPath.Replace
(info2.Extension, ".zip"));
stream2 = new ZipOutputStream(stream1);
this.ZipOneFile(stream1, stream2, sPath);
}
else if (Directory.Exists(sPath))
{
stream1 = new FileOutputStream(sPath + ".zip");
stream2 = new ZipOutputStream(stream1);
DirectoryInfo info1 = new DirectoryInfo(sPath);
this.ZipDirectory(stream1, stream2, info1, sPath);
}
stream2.close();
stream1.close();
stream2.flush();
stream1.flush();
}
private void CopyStream(FileInputStream src, ZipOutputStream
dest)
{
InputStreamReader reader1 = new InputStreamReader(src);
OutputStreamWriter writer1 = new OutputStreamWriter(dest);
while (reader1.ready())
{
writer1.write(reader1.read());
}
writer1.flush();
}
/*ZipDirectory Method zips the entire directory*/
private void ZipDirectory(FileOutputStream fos, ZipOutputStream
zos, DirectoryInfo di, string SRootDir)
{
FileInfo[] infoArray2 = di.GetFiles();
foreach (FileInfo info2 in infoArray2)
{
ZipEntry entry1 = new ZipEntry
(info2.FullName.Substring(SRootDir.LastIndexOf(@"\")));
entry1.setMethod(8);
zos.putNextEntry(entry1);
FileInputStream stream1 = new FileInputStream
(info2.FullName);
this.CopyStream(stream1, zos);
zos.closeEntry();
stream1.close();
}
DirectoryInfo[] infoArray1 = di.GetDirectories();
foreach (DirectoryInfo info1 in infoArray1)
{
this.ZipDirectory(fos, zos, info1, SRootDir);
}
}
</pre>
but when i run the code it gives me excetion
<big>java.io.File.getCanonicalPath() </big>
what should i do to run the code ???
any suggesations ???
Re: java.io.File.getCanonicalPath() exception in C#.net....