Class PathUtilities

java.lang.Object
ml.karmaconfigs.api.common.utils.file.PathUtilities

public final class PathUtilities extends Object
Karma file utilities
  • Constructor Details

    • PathUtilities

      public PathUtilities()
  • Method Details

    • create

      public static void create(@NotNull @NotNull Path file)
      Create a file
      Parameters:
      file - the file to create
    • createWithException

      public static void createWithException(@NotNull @NotNull Path file) throws IOException
      Create a file and catch any exception
      Parameters:
      file - the file to create
      Throws:
      IOException - any exception
    • createWithResults

      public static boolean createWithResults(@NotNull @NotNull Path file)
      Create a file and return if the file could be created
      Parameters:
      file - the file to create
      Returns:
      if the file could be created
    • destroy

      public static void destroy(@NotNull @NotNull Path file)
      Deletes a file
      Parameters:
      file - the path to delete
    • destroyWithException

      public static void destroyWithException(@NotNull @NotNull Path file) throws IOException
      Deletes a file and catch any exception
      Parameters:
      file - the path to delete
      Throws:
      IOException - any exception
    • destroyWithResults

      public static boolean destroyWithResults(@NotNull @NotNull Path file)
      Deletes a file and return if the file could be created
      Parameters:
      file - the path to delete
      Returns:
      if the file could be created
    • isKarmaPath

      public static boolean isKarmaPath(Path file)
      Get if the file is a karma file
      Parameters:
      file - the file
      Returns:
      if the file is a karma file
    • isValidPath

      public static boolean isValidPath(Path path)
      Get if the file is valid
      Parameters:
      path - the file
      Returns:
      if the file is a valid file
    • getParentPath

      public static String getParentPath(@NotNull @NotNull Path file)
      Get if the file is a valid file
      Parameters:
      file - the file
      Returns:
      if the file is a valid file
    • getPath

      public static String getPath(Path file)
      Get the file path
      Parameters:
      file - the file path
      Returns:
      the file path
    • getPrettyParentPath

      public static String getPrettyParentPath(@NotNull @NotNull Path file)
      Get the pretty file
      Parameters:
      file - the file
      Returns:
      the pretty file
    • getPrettyFile

      public static String getPrettyFile(Path file)
      Get the pretty file path
      Parameters:
      file - the file
      Returns:
      the pretty file path
    • getParentPath

      public static String getParentPath(@NotNull @NotNull Path file, char barReplace)
      Get the parent file replacing %20 ( space char )
      Parameters:
      file - the file
      barReplace - the %20 replace
      Returns:
      the parent file
    • getPath

      public static String getPath(@NotNull @NotNull Path file, char barReplace)
      Get the file replacing the %20 ( space char )
      Parameters:
      file - the file
      barReplace - the %20 replace
      Returns:
      the file
    • getExtension

      public static String getExtension(@NotNull @NotNull Path file)
      Get the file extension
      Parameters:
      file - the file
      Returns:
      the file extension
    • getName

      public static String getName(@NotNull @NotNull Path file, boolean extension)
      Get the file name
      Parameters:
      file - the file name
      extension - include extension
      Returns:
      the file name
    • getPathType

      public static String getPathType(Path file)
      Get the file type
      Parameters:
      file - the file tpy
      Returns:
      the file type
    • getPathCompleteType

      public static String getPathCompleteType(Path file)
      Get the file complete type
      Parameters:
      file - the file complete type
      Returns:
      the file type
    • readAllLines

      public static List<String> readAllLines(Path file)
      Read all the file lines
      Parameters:
      file - the file
      Returns:
      all the file lines
    • getSourcePath

      public static Path getSourcePath(KarmaSource source)
      Get the karma source jar file
      Parameters:
      source - the karma source
      Returns:
      the source jar file
    • getFixedPath

      public static Path getFixedPath(@NotNull @NotNull Path file)
      Fix a file
      Parameters:
      file - the file
      Returns:
      the fixed file
    • getProjectPath

      public static Path getProjectPath(String delimiter)
      Get the project folder
      Parameters:
      delimiter - the project complete path delimiter
      Returns:
      the project folder
    • getProjectParent

      public static Path getProjectParent()
      Get the project parent folder
      Returns:
      the project parent folder
    • getProjectPath

      @Deprecated public static Path getProjectPath(KarmaSource source)
      Deprecated.
      Get the project folder
      Parameters:
      source - the source
      Returns:
      the project folder