Java Reference
In-Depth Information
}
catch (IOException ioe)
{
String msg = args[0]+" could not be read, or
"+args[1]+
" could not be written";
System.err.println(msg);
}
}
static void copy(String srcFile, String dstFile) throws
IOException
{
FileInputStream fis = new FileInputStream(srcFile);
try
{
FileOutputStream
fos
=
new
FileOut-
putStream(dstFile);
try
{
int b;
while ((b = fis.read()) != -1)
fos.write(b);
}
finally
{
try
{
fos.close();
}
catch (IOException ioe)
{
System.err.println("unable to close "+d-
stFile);
}
}
}
Search WWH ::




Custom Search