Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace FileTools

Module that provides methods to work with android file system

Index

Variables

mntdir: string

Defines path to android /mnt directory

moddir: string

Defines mods folder path, ends with "/"

root: string

Defines user directory path, ends with "/"

Functions

  • GetListOfDirs(path: string): java.io.File[]
  • Lists children directories for the specified path

    Parameters

    • path: string

      home-relative or absolute path to the file

    Returns java.io.File[]

    array of java.io.File instances of listed directories

  • GetListOfFiles(path: string, ext: string): java.io.File[]
  • Lists files in the specified directory

    Parameters

    • path: string

      path to directory to look for files in

    • ext: string

      extension of the files to include to the output. Use empty string to include all files

    Returns java.io.File[]

    array of java.io.File instances that match specified extension

  • ReadBytesAsset(name: string): native.Array<jbyte>
  • Reads bytes array from assets

    Parameters

    • name: string

      asset name

    Returns native.Array<jbyte>

    java array of bytes read from assets or null if asset doesn't exist

  • ReadImage(file: string): Nullable<android.graphics.Bitmap>
  • Reads bitmap from file

    Parameters

    • file: string

      home-relative or absolute path to the file

    Returns Nullable<android.graphics.Bitmap>

    android.graphics.Bitmap object of the bitmap that was read from file or null if file does not exist or is not accessible

  • ReadImageAsset(name: string): Nullable<android.graphics.Bitmap>
  • Reads bitmap from asset by its full name

    Parameters

    • name: string

      asset name

    Returns Nullable<android.graphics.Bitmap>

    android.graphics.Bitmap object of the bitmap that was read from asset or null, if asset doesn't exist

  • ReadJSON(dir: string): any
  • Reads file as JSON

    Parameters

    • dir: string

      home-relative or absolute path to the file

    Returns any

    value read from JSON file

  • ReadKeyValueFile(dir: string, specialSeparator?: string): {}
  • Reads file as key:value pairs

    Parameters

    • dir: string

      home-relative or absolute path to the file

    • Optional specialSeparator: string

      separator between key and value, ":" by default

    Returns {}

    object containing key:value pairs from file

    • [key: string]: string
  • Reads text from file

    Parameters

    • file: any

      home-relative or absolute path to the file

    Returns Nullable<string>

    file contents or null if file does not exist or not accessible

  • ReadTextAsset(name: string): string
  • Reads string from asset by its full name

    Parameters

    • name: string

      asset name

    Returns string

    asset contents or null if asset doesn't exist

  • WriteImage(file: string, bitmap: Bitmap): void
  • Writes bitmap to png file

    Parameters

    • file: string

      home-relative or absolute path to the file

    • bitmap: Bitmap

      android.graphics.Bitmap object of the bitmap to be written to the file

    Returns void

  • WriteJSON(dir: string, obj: any, beautify: boolean): void
  • Writes object to file as JSON

    Parameters

    • dir: string

      home-relative or absolute path to the file

    • obj: any

      object to be written to the file as JSON

    • beautify: boolean

      if true, output JSON is beautified

    Returns void

  • WriteKeyValueFile(dir: string, data: object, specialSeparator?: string): void
  • Writes key:value pairs to the file

    Parameters

    • dir: string

      home-relative or absolute path to the file

    • data: object

      object to be written to the file as a set of key:value pairs

    • Optional specialSeparator: string

      separator between key and value, ":" by default

    Returns void

  • WriteText(file: string, text: string, add?: boolean): void
  • Writes text to the file

    Parameters

    • file: string

      home-relative or absolute path to the file

    • text: string

      text to be written to the file

    • Optional add: boolean

      if true, appends text to the file, overrides it otherwise. Default value is false

    Returns void

  • getFullPath(path: string): string
  • Converts home-relative path to absolute

    Parameters

    • path: string

      input path

    Returns string

    input string if input string is an absolute path, an absolute path if input string is a home-relative path

  • isExists(path: string): boolean
  • Verifies if specified home-relative or absolute path exists

    Parameters

    • path: string

      path to be verified

    Returns boolean

    true, if specified path exists, false otherwise

  • mkdir(dir: string): void
  • Creates directory by its home-relative or absolute path, if one of the parent directories doesn't exist, creates them

    Parameters

    • dir: string

      path to the new directory

    Returns void

  • mkworkdirs(): void
  • Creates CoreEngine working directories. Called by CoreEngine and should not be called by end user

    Returns void

Generated using TypeDoc