SCENARIO
I've a util class that makes a zip file from folder, and returns the file. This works perfect.
public static class MakeZip {
// returns zip file, null otherwise
public static File doZip(File folderToZip)
}
PROBLEM
came when I want to control the possible error scenarios, connection problems, empty folder, zip fail etc... I'm wondering best way to create the file and return the result, for this, I created an enum
public static enum ZIP_RESULT {
OK, KO, EMPTY_FOLDER;
}
IDEAS
a) Create a file class attribute
private File zipFile;
and return ZIP_FILE enum in doZip method.
public ZIP_RESULT doZip(File folderToZip)
b) Modify the File sent:
public ZIP_RESULT doZip(File folderToZip, File fileToZip)
c) ????
QUESTION
There is a pattern, convention or best practice for this kind of file modification expecting enum as result? I guess is a really typical scenario to have it...
Aucun commentaire:
Enregistrer un commentaire