/**
* This class copies an input file to output file
*
* @param String input file to copy from
* @param String output file
*/
public static boolean copy(String input, String output) throws Exception {
int BUFSIZE = 65536;
FileInputStream fis = new FileInputStream(input);
FileOutputStream fos = new FileOutputStream(output);
try {
int s;
byte[] buf = new byte[BUFSIZE];
while ((s = fis.read(buf)) > -1 ){
fos.write(buf, 0, s);
}
}
catch (Exception ex) {
throw new Exception("Can not copy " + input + " to " + output + ex.getMessage());
}
finally {
fis.close();
fos.close();
}
return true;
}
* This class copies an input file to output file
*
* @param String input file to copy from
* @param String output file
*/
public static boolean copy(String input, String output) throws Exception {
int BUFSIZE = 65536;
FileInputStream fis = new FileInputStream(input);
FileOutputStream fos = new FileOutputStream(output);
try {
int s;
byte[] buf = new byte[BUFSIZE];
while ((s = fis.read(buf)) > -1 ){
fos.write(buf, 0, s);
}
}
catch (Exception ex) {
throw new Exception("Can not copy " + input + " to " + output + ex.getMessage());
}
finally {
fis.close();
fos.close();
}
return true;
}
setLastModifiedpublic boolean setLastModified(long time)
Sets the last-modified time of the file or directory named by this abstract pathname. All platforms support file-modification times to the nearest second, but some provide more precision. The argument will be truncated to fit the supported precision. If the operation succeeds and no intervening operations on the file take place, then the next invocation of the lastModified() method will return the (possibly truncated) time argument that was passed to this method.Parameters:time - The new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)Returns:true if and only if the operation succeeded; false otherwiseThrows:IllegalArgumentException - If the argument is negative
SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.io.FileDescriptor) method denies write access to the named fileSince: 1.2