Package fr.formiko.usuel
Class fichier
java.lang.Object
fr.formiko.usuel.fichier
tools about Files.
- Author:
- Hydrolien Baeldung
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static void
copierUnFichier(String fileSourceName)
static void
copierUnFichier(String fileSourceName, String fileTargetName)
static boolean
deleteDirectory(File directoryToBeDeleted)
Delete a directory and all his content.static boolean
static boolean
static boolean
Download a file from the web.static void
private static long
getFileSize(URL url)
return the size of the downloaded file.static GString
make a liste of all .java file in the directory f.static GString
listerLesFichiersDuRep(String rep)
static File
a safe way to create a File from a zip file to avoid Zip Slip.static boolean
a safe way to open an URI.static boolean
openWebLink(String url)
a safe way to launch a web page.static void
a class to unzip file.static void
a class to zip file.private static void
zipFile(File fileToZip, String fileName, ZipOutputStream zipOut, String outputFile)
a class to do main part of ziping a file.
-
Constructor Details
-
fichier
public fichier()
-
-
Method Details
-
listerLesFichiersDuRep
make a liste of all .java file in the directory f.- Parameters:
f
- The directory were to search java file.
-
listerLesFichiersDuRep
-
deleteDirectory
Delete a directory and all his content.
If it's a folder it will call deleteDirectory on all sub file/folder and then destroy itself. If it's a file it will destroy itself. -
deleteDirectory
-
affichageDesLecteurALaRacine
-
fichierCiblePeuAvoirCeNom
-
copierUnFichier
-
copierUnFichier
-
download
Download a file from the web.- Parameters:
urlPath
- the url as a StringfileName
- the name of the file were to save data from the webwithInfo
- if true launch a thread to have info during download
-
download
-
getFileSize
return the size of the downloaded file. -
zip
a class to zip file.
cf https://www.baeldung.com/java-compress-and-uncompress -
zipFile
private static void zipFile(File fileToZip, String fileName, ZipOutputStream zipOut, String outputFile)a class to do main part of ziping a file.
cf https://www.baeldung.com/java-compress-and-uncompress -
unzip
a class to unzip file.
cf https://www.baeldung.com/java-compress-and-uncompress- Parameters:
fileName
- the name of the .zip file.folderName
- the name of the folder were to save data from the .zip.
-
newFile
a safe way to create a File from a zip file to avoid Zip Slip.- Parameters:
destinationDir
- File that we whant to create in the zipEntry folder.zipEntry
- the ZipEntry.- Throws:
IOException
-
openWebLink
a safe way to launch a web page.- Parameters:
url
- the URL to open
-
openURI
a safe way to open an URI.- Parameters:
uri
- the URI to open
-