Class FileSystem

java.lang.Object
com.vivoka.vsdk.util.FileSystem

public class FileSystem extends Object
Utility class for working with file system
  • Constructor Details

    • FileSystem

      public FileSystem()
  • Method Details

    • getPath

      public static String getPath(String first, String... more)
      Builds a path from the given parts.
      Parameters:
      first - First part of the path.
      more - Additional parts of the path.
      Returns:
      Built path
    • isAbsolutePath

      public static boolean isAbsolutePath(String filePath)
      Checks if the given path is absolute.
      Parameters:
      filePath - Path to check
      Returns:
      true if the path is absolute, false otherwise
    • absolutePath

      public static String absolutePath(String filePath) throws Exception
      Converts a relative path to an absolute path.
      Parameters:
      filePath - Relative path
      Returns:
      Absolute path
      Throws:
      Exception - If the conversion fails
    • loadJsonObjectFromStorage

      public static org.json.JSONObject loadJsonObjectFromStorage(String filePath) throws Exception
      Loads a json file from storage and returns it as a JSONObject.
      Parameters:
      filePath - Path to the json file
      Returns:
      Parsed json
      Throws:
      Exception - If failed to parse the json
    • loadJsonObjectFromAssets

      public static org.json.JSONObject loadJsonObjectFromAssets(String filePath) throws Exception
      Loads a json file from assets and returns it as a JSONObject.
      Parameters:
      filePath - Path to the json file in assets
      Returns:
      Parsed json
      Throws:
      Exception - If failed to parse the json
    • readFileFromStorage

      public static String readFileFromStorage(String filePath) throws Exception
      Reads a file from storage and returns its content as a string.
      Parameters:
      filePath - Path to the file
      Returns:
      File content
      Throws:
      Exception - If failed to read the file
    • readFileFromAssets

      public static String readFileFromAssets(String filePath) throws Exception
      Reads a file from assets and returns its content as a string.
      Parameters:
      filePath - Path to the file in assets
      Returns:
      File content
      Throws:
      Exception - If failed to read the file