Class XNioPathUtils

java.lang.Object
de.xima.fc.utils.XNioPathUtils

public final class XNioPathUtils extends Object
Helper functions for Path instances.
Since:
8.0.0
Author:
XIMA MEDIA GmbH
  • Method Details

    • deleteQuietly

      public static void deleteQuietly(Path path)
      Deletes the file at the given path, ignoring any exceptions that may occur.
      Parameters:
      path - Path to delete.
    • fileSizeOrZero

      public static long fileSizeOrZero(Path path)
      Gets the size of the given file. When not a regular file or the file does not exist, 0 is returned.
      Parameters:
      path - Path to the file.
      Returns:
      The size of the given file.
    • getFileName

      public static String getFileName(Path path)
      Gets the file name of the given path, or empty when the path does not have any path segments.
      Parameters:
      path - Path to process.
      Returns:
      The file name of the given path.
    • readFileToByteArray

      public static byte[] readFileToByteArray(Path path) throws IOException
      Reads the contents of the file at the given path into a byte array.
      Parameters:
      path - Path to read.
      Returns:
      The contents of the file at the given path as a byte array.
      Throws:
      IOException