$io

io (note: this function supports currently rollback only partly): parameter 1 specifies source/target: debug (a shortcut for target = stderr, method = write, path: none, type = 1, parameter 3: message) | private (targets to the siteforum static directory) | protected (targets to the accounts static directory) | public (targets to the servers public www directory ) | stdout | stderr). parameter 2 specifies method (append | copy | delete | exists | getLength | getExtension | getModificationTime | getName | isDir | list | listDirs | listFiles | mkDirs | move | read | receive (receive the clients upload) | rewrite | setLength | touch | write | zipAdd | zipExtract, skip this parameter for target = stderr or stdout or debug). parameter 3 specifies relative file path (skip this parameter for target = stderr, stdout or debug). parameter 4 specifies type (bytes per character, 1 | 2, you typically use 1 for ascii operations or to write to stdout and stderr). for read parameter 5 is offset (optional, defaults to 0) and parameter 6 is length (optional, defaults to the count of characters available). for write and append parameter 5 is the data.
Syntax(No syntax available.)
Documentation1. Read a file:$io{read}{file_name}{bytes_per_character}{offset}{length}

    Parameters:
      read, read the specified file.
      file_name, the name of the file to read (see the note about the filename syntax at the end of this document).
      bytes_per_character, the amount of bytes per character. Valid values are 1 for ASCII characters or 2 for unicode characters. The value of this parameter defaults to 1.
      offset, an offset of the specified file to start reading from.
      length, an amount of bytes to read starting from the specified offset.
    Returns:
      the contents of the file read in the range of 'offset' through 'offset' + 'length'.
2. Write a file: $io{write_method}{file_name}{bytes_per_character}{contents}{offset}

    Parameters:

      write_method:
        append, appends the 'file_contents' to the end of the specified file.
        rewrite, overwrites the specified file with the given contents.
        write, writes the given contents into the specified file starting at 'offset'.
      file_name, the name of the file to be writen (see the note about the filename syntax at the end of this document).
      bytes_per_character, the amount of bytes per character. Valid values are 1 for ASCII characters or 2 for unicode characters. The value of this parameter defaults to 1.
      file_contents, the contents to be writen to the specified file.
      offset, the position in the specified file to start writting at. This parameter is only expected by the 'write' method.
3. Copy / Move a file: $io{copy_method}{source_file_name}{target_directory}

    Parameters:
      copy_method:
        copy, copies the specified file to the given target_directory.
        move, moves the specified file to the given target_directory.
      source_file_name, the name of the source file to be copied or moved (see the note about the filename syntax at the end of this document).
      target_directory, the target directory path to copy or move the file to (see the note about the filename syntax at the end of this document).
4. Delete a file: $io{delete}{file_name}

    Parameters:
      delete, a flag to indicate that the specified file is to be deleted.
      file_name, the name of the file to be deleted (see the note about the filename syntax at the end of this document).
5. List a directory: $io{list_method}{directory}

    Parameters:
      list_method:
        list, returns a listing of the all files and subdirectories contained in the specified directory.
        listDirs, returns a listing of all subdirectories contained in the specified directory.
        listFiles, returns a listing of all the files contained in the specified directory.
      directory, the path of the directory to be listed (see the note about the filename syntax at the end of this document).
    Returns:
      a list of the files contained in the specified directory separeted by the new line character.
6. Examine a files existance: $io{exists}{file_name}
    Parameters:
      exists, a flag to indicate that the existance of the specified file is to be examined.
      file_name, the name of the file whos existance is to be examined (see the note about the filename syntax at the end of this document).
    Returns:
      1 if and only if the specified file exists; 0 otherwise.
7. Get a files extension: $io{getExtension}{file_name}

    Parameters:
      getExtension, a flag to indicate that the extension of the specified file is requested.
      file_name, the name of the file whos extension is requested (see the note about the filename syntax at the end of this document).
    Returns:
      the requested extension of the specified file.
8. Get a files length: $io{getLength}{file_name}

    Parameters:
      getLength, a flag to indicate that the length of the specified file is requested.
      file_name, the name of the file whos length is requested (see the note about the filename syntax at the end of this document).
    Returns:
      the requested length as an amount of bytes of the specified file.
9. Get a files modification time: $io{getModificationTime}{file_name}

    Parameters:
      getModificationTime, a flag to indicate that the modification time of the specified file is requested.
      file_name, the name of the file whos modification time is requested (see the note about the filename syntax at the end of this document).
    Returns:
      the requested modification time of the specified file.
10. Get a files name: $io{getName}{file_name}

    Parameters:
      getName, a flag to indicate that the name of the specified file is requested.
      file_name, the name of the file whos name is requested (see the note about the filename syntax at the end of this document).
    Returns:
      the requested name of the specified file.
11. Examine whether the file denoted by the given abstract pathname is a directory: $io{isDir}{path_name}

    Parameters:
      isDir, a flag to indicate the examination whether the file denoted by the given abstract pathname is a directory.
      path_name, the name of the path to examine (see the note about the filename syntax at the end of this document).
    Returns:
      1 if the given path is a directory; 0 otherwise.
12. Create a file: $io{mkdirs}{file_name}

    Parameters:
      mkdirs, aflag to indicate that the specified file is to be created.
      file_name, the name of the file to be created (see the note about the filename syntax at the end of this document).
    Note:
      this method will create the directory or file named by the specified file_name, including any necessary but nonexistent parent directories.
13. Upload a file: $io{receive}{target_path}{max_length}

    Parameters:
      receive, a flag to indicate that a file is to be uploded.
      target_path, the path the uploaded file is to be stored at (see the note about the filename syntax at the end of this document).
      max_length, the maximum length the uploaded file can have.
    Returns:
      the names of the uploaded files separeted by a new line character.
14. Set the length of a file: $io{setLength}{file_name}{new_length}

    Parameters:
      setLength, a flag to indicate that the length of the specified file is to be changed.
      file_name, the name of the file whos length is to be changed (see the note about the filename syntax at the end of this document).
      new_length, the new length of the file.
    NOTE:
      If the present length of the file as returned by the $io{getLength}{file_name} method is greater than the 'new_length' argument
      then the file will be truncated. If the present length of the file as returned by the $io{getLength}{file_name} method is
      smaller than the 'new_length' argument then the file will be extended. In this case, the contents of the extended portion of the file are not defined.
15. Change the 'last modified' attribute of a file: $io{touch}{file_name}

    Parameters:
      touch, a flag to indicate that the 'last modified' attribute of the specified file is to be changed.
      file_name, the name of the file. If the file does not exist it will be created (see the note about the filename syntax at the end of this document).
16. Compress a file: $io{zipAdd}{zip_file_name}{file_name}{bytes_per_character}{file_contents}

    Parameters:
      zipAdd, a flag to indicate that the specified file is to be zipped.
      zip_file_name, the name of the zip file (see the note about the filename syntax at the end of this document). If the zip file exists the specified file will be added to its contents else the zip file will be created.
      file_name, the name of the file to be zipped (see the note about the filename syntax at the end of this document).
      bytes_per_character, the amount of bytes per character. Valid values are 1 for ASCII characters or 2 for unicode characters. The value of this parameter defaults to 1.
      file_contents, the contents of the file to be zipped.
17. Extract a zip file: $io{zipExtract}{zip_file_name}

    Parameters:
      zipExtract, a flag to indicate that the specified zip file is to be exctracted.
      zip_file_name, the name of the zip file (see the note about the filename syntax at the end of this document).
    NOTE:
      The syntax of filenames is: root_path://file_path .
      Valid values for root_path are:
        - log, sets the root_path to be the SITEFORUM log directory (Read-Only).
        - private, sets the root_path to be the SITEFORUM static directory.
        - protected, sets the root_path to be the static directory of the current account.
        - public, sets the root_path to be the servers public www directory.
        - tmp, sets the root_path to be the SITEFORUM tmp directory.
      any of the protocols http, https or ftp for accessing files out of the SITEFORUM servers scope.
      file_path can be any path contained to the specified root_path.
Examples
Command Parameter1 Parameter2 Parameter3 Parameter4 Parameter5 Parameter6 Description
$io debug text directs output to console
stderr 1/2 bytes per Char text directs output to stderror
stdout 1/2 bytes per Char text directs output to stdout
private append path source 1/2 byte per Char text appends text to existing file or creates the file
public copy path source path target copy file
protected delete path deletes file
exists path 1 - file exists
0- file does not exists
getLength path length of file in bytes
getModificationTime path last access to file
isDir path file - 0
directory - 1
nothing - Exception
list path list of all files and directories in path
listDirs path list of all files and directories in path
listFiles path list of all files in path
move path path move file
read path 1/2 byte per Char startoffset length read file
rewrite path 1/2 byte per Char text overwrites existing files
setLength Pfad length in byte sets file length
touch path touches file
write path 1/2 byte per Char startoffset writes file at offset
GroupSpecial
Minimum required transaction-mode:UPDATE=IO
Required scripting permission of the developerPERMISSION_FL_BASIC
Minimum parameters2
Maximum parameters 5