Interface Paths


public interface Paths
Static methods that return a Path by converting a path string or URI.
  • Field Details

    • home

      static final String home
      Smile home directory.
    • resourceFileSystems

      static final List<FileSystem> resourceFileSystems
      Readonly file systems for resources.
  • Method Details

    • resource

      static Optional<Path> resource(Class<?> clazz, String path)
      Returns the file path of a resource.
      Parameters:
      clazz - the class to load the resource.
      path - the resource path.
      Returns:
      the file path of the resource.
    • resource

      static Optional<Path> resource(String path)
      Returns the file path of a resource.
      Parameters:
      path - the resource path.
      Returns:
      the file path of the resource.
    • getFileName

      static String getFileName(Path path)
      Returns the file name without extension.
      Parameters:
      path - the file path.
      Returns:
      the file name without extension.
    • getFileExtension

      static String getFileExtension(Path path)
      Returns the file extension in lower case.
      Parameters:
      path - the file path.
      Returns:
      the file extension in lower case, or empty string if no extension is found.
    • isBinary

      static boolean isBinary(Path path)
      Heuristically checks if a file is likely a binary file. The method considers a file binary if it contains any null bytes within the first 1024 bytes.
      Parameters:
      path - The file to check.
      Returns:
      true if the file is likely binary, false otherwise.
    • getTestData

      static Path getTestData(String... path)
      Get the file path of a test sample dataset.
      Parameters:
      path - the path strings to be joined to form the path.
      Returns:
      the file path to the test data.
    • getTestDataReader

      static BufferedReader getTestDataReader(String... path) throws IOException
      Returns the reader of a test data.
      Parameters:
      path - the path strings to be joined to form the path.
      Returns:
      the reader of the test data.
      Throws:
      IOException - when fails to create the reader.
    • getTestDataLines

      static Stream<String> getTestDataLines(String... path) throws IOException
      Returns the reader of a test data.
      Parameters:
      path - the path strings to be joined to form the path.
      Returns:
      the file lines of test data.
      Throws:
      IOException - when fails to read the file.