Damn good work!

I think we should introduce a FileUtils class, I dont want to bloat the FileObject with "utility functions".

About transactionality :- care should be taken to not reimplement something like [transaction], they already implemented such a beast using java.io.File. Maybe we can adopt it.

So my FileUtils would look like this:

public class FileUtils
{
void copy(InputStream is, FileObject fo) throws FuException;
void copy(FileObject input, FileObject new) throws FuException;
void copy(FileObject fo, OutputStream out) throws FuException;
void copy(InputStream is, FileObject fo, BackupStrategy bs) throws FuException;
void copy(FileObject input, FileObject new, BackupStrategy bs) throws FuException;


void move(FileObject old, FileObject new) throws FuException;
void move(FileObject old, FileObject new, BackupStrategy bs) throws FuException;


void append(FileObject input, FileObject new) throws FuException;
void append(InputStream is, FileObject new) throws FuException;
void append(FileObject input, FileObject new, BackupStrategy bs) throws FuException;
void append(InputStream is, FileObject new, BackupStrategy bs) throws FuException;


   void delete(FileObject fo) throws FuException;

....
}

public interface BackupStrategy
{
/**
* Takes the fileObject and moves it away.
* returns the new file or null if the file has been deleted. (e.g. file overwrite)
*/
FileObject createBackup(FileObject fileObject) throws FuException;
}



Thanks! --- Mario

PS: isnt "throw (IOException) new IOException().initCause(e);" what you searched?


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to