Claudia Neri

Greenhorn
+ Follow
since Mar 06, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Claudia Neri

Thanks a million for your reply.
Here's the code for the copyFile()...as far as I can see it is closing all the files.
What do you think?
/**
* method to copy files.
* @return void
* @param String inName
* @param String outName
* @throw IOException
*/
public static void copyFile(String inName, String outName)throws IOException
{
BufferedInputStream is = new BufferedInputStream(
new FileInputStream(inName));
BufferedOutputStream os = new BufferedOutputStream(
new FileOutputStream(outName));
copyDataFile( is, os, true);
}// end of copyFile
//----------------------------------------------------------------
/**
* method to copy files.
* @return void
* @param InputStream is
* @param OutputStream os
* @param boolean close
* @throw IOException
*/
public static void copyDataFile(InputStream is, OutputStream os, boolean close) throws IOException
{
int b;
while(( b = is.read()) != -1 )
{
os.write( b );
}
is.close();
if( close )
os.close();
}//end of copyDataFile
20 years ago
Does anyone know how to do this??? Please help! Thanks
20 years ago
I am writing a backup class, the full() method should delete what's in the destination and recreate everything.
When the destination directory is empty and I run it, it works fine.
If the destination isn't empty, it deletes the contents, creates the root directory which will then contain all the subdirectories.
It works properly if the destination folder is not modified, if a folder is added to it, but if a file is added and you then run full(), (which should delete everything, including the newly created file, and they copy the contents of the source), it gives the following message whenever it tries to create a file(but not a directory): java.io.IOException: Access is denied
I think it might have something to do with the createNewFile() method.
Please find below the code for the Backup.java class

*Code tags added for easier reading -- Jason*
[ March 18, 2004: Message edited by: jason adam ]
20 years ago
I am writing a java program for a backup tool, when I try to backup something and the application tries to copy a file in use or that can't be read for other reason, it throws a FileNotFoundException.
What I am asking is, would it be possible to catch the exeption, print a message with the name of the file, but then keep on copying the remaining files?
Thanks a million for your help
20 years ago