}
public void copy(File srcFile, String filename) throws FileSystemException {
// make sure the file exists
if (!srcFile.exists()) {
throw new FileSystemException("Source file " + srcFile.getName() + " does not exist");
}
// make sure we are permitted to read it
if (!srcFile.canRead()) {
throw new FileSystemException("Cannot read source file " + srcFile.getName() + " (permission denied?)");
}
// open an input stream
FileInputStream in = null;
try {
in = new FileInputStream(srcFile);
} catch (Exception e) {
throw new FileSystemException("Unable to create input stream for file " + srcFile.getName(), e);
}
try {
// delegate handling to input stream method
copy(in, filename);