Class fichier

java.lang.Object
fr.formiko.usuel.fichier

public class fichier extends Object
tools about Files.
Author:
Hydrolien Baeldung
  • Constructor Details

    • fichier

      public fichier()
  • Method Details

    • listerLesFichiersDuRep

      public static GString listerLesFichiersDuRep(File f)
      make a liste of all .java file in the directory f.
      Parameters:
      f - The directory were to search java file.
    • listerLesFichiersDuRep

      public static GString listerLesFichiersDuRep(String rep)
    • deleteDirectory

      public static boolean deleteDirectory(File directoryToBeDeleted)
      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

      public static boolean deleteDirectory(String s)
    • affichageDesLecteurALaRacine

      public static void affichageDesLecteurALaRacine(File f)
    • fichierCiblePeuAvoirCeNom

      public static void fichierCiblePeuAvoirCeNom(String nom)
    • copierUnFichier

      public static void copierUnFichier(String fileSourceName)
    • copierUnFichier

      public static void copierUnFichier(String fileSourceName, String fileTargetName)
    • download

      public static boolean download(String urlPath, String fileName, boolean withInfo)
      Download a file from the web.
      Parameters:
      urlPath - the url as a String
      fileName - the name of the file were to save data from the web
      withInfo - if true launch a thread to have info during download
    • download

      public static boolean download(String urlPath, String fileName)
    • getFileSize

      private static long getFileSize(URL url)
      return the size of the downloaded file.
    • zip

      public static void zip(String sourceFolder, String outputFile)
      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

      public static void unzip(String fileName, String folderName)
      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

      public static File newFile(File destinationDir, ZipEntry zipEntry) throws IOException
      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

      public static boolean openWebLink(String url)
      a safe way to launch a web page.
      Parameters:
      url - the URL to open
    • openURI

      public static boolean openURI(URI uri)
      a safe way to open an URI.
      Parameters:
      uri - the URI to open