JavaScript - JavaScript Bible (Gold Edition)
JavaScript - JavaScript Bible (Gold Edition)
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
/**
Class to manage the general operations of files using JAVA,
in which the use of the fundamental objects FileReader, FileWriter will be demonstrated
* @author martosfre
See [Link]
Sep 23, 2010
*/
public class AdminArchivo {
/**
Method to create a directory, it is not necessary to calculate the IOException exception
* @param directoryName
* @param path
* @return
*/
public boolean createDirectory(String directoryName, String path){
File directory = new File(path + [Link] + directoryName);
return [Link]();
}
/**
Method to copy the content of one file to another
* @param sourceFile
* @param destinationFile
* @return
* @throws IOException
* @throws ClassNotFoundException
*/
public boolean copyFileContent(File sourceFile, File destinationFile) throws IOException,
ClassNotFoundException{
/**
Method to recover the files given a directory
* @param directory
* @return
*/
public File[] recoverFilesFromDirectory(File directory) throws IOException{
/**
Method for writing data to a file
* @return
*/
public File writeFile() {
return null;
/**
Method to move a file from one location to another
* @return
*/
public boolean moveFile() {
return false;
}
/**
Method to modify a file following what is already there
* @return
*/
public boolean modifyFile() {
return false;
}
try {
The [Link] must be created beforehand before proceeding as it is the data source.
File sourceFile = new File(fileLocation + [Link] + "[Link]");
File destinationFile = new File(fileLocation + [Link] + "[Link]");
We verify that the directory exists
if(new File(locationFile + [Link] + "cec_epn").exists()){
:
if(successfulCopy){
[Link](new File(fileLocation));
}
translatedText
if([Link]("cec_epn", fileLocation)){
boolean successfulCopy = [Link](sourceFile, destinationFile
if(successfulCopy){
[Link](new File(fileLocation));
}
else {
Problems creating directory, possible permission error
}
}
} catch (IOException e) {
[Link]("Error IO:" + [Link]());
[Link]();
catch (ClassNotFoundException e) {
[Link]("Error CNF:" + [Link]());
[Link]();
}catch(Exception e){
[Link]("General Error:" + [Link]());
}
}
}
2 of 2 09/18/2012 16:08