Qorus Integration Engine®  4.1.4.p2_git
fs Class Reference

main fs service class More...

Inherits QorusSystemService.

Public Member Methods

nothing rename (string source, string target, softbool man=False)
 rename/move a file More...
 
nothing rename_conn (string conn_src, string source, string conn_tgt, string target, softbool man=False)
 rename/move a file More...
 
nothing _copy (string source, string target)
 copy a file More...
 
nothing copy_conn (string conn_src, string source, string conn_tgt, string target)
 copy a file More...
 
nothing del (string path)
 delete a file More...
 
nothing del_conn (string conn, string path)
 delete a file More...
 
list ls (string path, *string regex, *softint reopts, *string encoding)
 lists files in the given directory More...
 
list ls_conn (string conn, *string path, *string regex, *softint reopts, *string encoding)
 lists files in the given directory More...
 
binary get_file_bin (string path)
 returns the given file as binary data More...
 
binary get_file_bin_conn (string conn, string path)
 returns the given file as binary data More...
 
string get_file_string (string path, *string encoding)
 returns the given file as string data More...
 
string get_file_string_conn (string conn, string path, *string encoding)
 returns the given file as string data More...
 
nothing write_file (string path, data data, int mode=0664, *string encoding)
 writes the input data to the given location More...
 
nothing write_file_conn (string conn, string path, data data, int mode=0664, *string encoding)
 writes the input data to the given location More...
 
*hash hstat_file (string path)
 runs Qore::hstat() on a file target and returns the result More...
 
*hash hstat_file_conn (string conn, string path)
 runs Qore::hstat() on a file target and returns the result More...
 

Detailed Description

main fs service class

Member Function Documentation

◆ _copy()

nothing fs::_copy ( string  source,
string  target 
)
inline

copy a file

Parameters
sourcethe source path
targetthe target path

If any errors occur, an exception is thrown

Exceptions
COPY-ERRORcannot stat() source file

◆ copy_conn()

nothing fs::copy_conn ( string  conn_src,
string  source,
string  conn_tgt,
string  target 
)
inline

copy a file

Parameters
conn_srcthe source user connection name
sourcethe source path, relative to conn_src
conn_tgtthe target user connection name
targetthe target path, relative to conn_tgt

If any errors occur, an exception is thrown

Exceptions
CONNECTION-ERRORthe given connection is not known
COPY-ERRORcannot stat() source file
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection

◆ del()

nothing fs::del ( string  path)
inline

delete a file

Parameters
paththe path of the file to delete

If any errors occur, an exception is thrown

Exceptions
UNLINK-ERRORerror removing the file

◆ del_conn()

nothing fs::del_conn ( string  conn,
string  path 
)
inline

delete a file

Parameters
connan user connection name
paththe path of the file to delete, relative to conn

If any errors occur, an exception is thrown

Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
UNLINK-ERRORerror removing the file

◆ get_file_bin()

binary fs::get_file_bin ( string  path)
inline

returns the given file as binary data

Parameters
paththe path of the file to retrieve
Returns
the file data as binary data

◆ get_file_bin_conn()

binary fs::get_file_bin_conn ( string  conn,
string  path 
)
inline

returns the given file as binary data

Parameters
connan user connection name
paththe path of the file to retrieve, relative to conn
Returns
the file data as binary data
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection

◆ get_file_string()

string fs::get_file_string ( string  path,
*string  encoding 
)
inline

returns the given file as string data

Parameters
paththe path of the file to retrieve
encodingthe encoding of the source file
Returns
the file data as a string

◆ get_file_string_conn()

string fs::get_file_string_conn ( string  conn,
string  path,
*string  encoding 
)
inline

returns the given file as string data

Parameters
connanuser connection
paththe path of the file to retrieve
encodingthe encoding of the source file
Returns
the file data as a string
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection

◆ hstat_file()

*hash fs::hstat_file ( string  path)
inline

runs Qore::hstat() on a file target and returns the result

Parameters
paththe path of the file to stat
Returns
NOTHING or a StatInfo file status value hashes for the path argument
See also
Qore::hstat()

◆ hstat_file_conn()

*hash fs::hstat_file_conn ( string  conn,
string  path 
)
inline

runs Qore::hstat() on a file target and returns the result

Parameters
conna user connection; must be a filesystem connection
paththe path of the file to stat
Returns
NOTHING or a StatInfo file status value hashes for the path argument
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
See also
Qore::hstat()

◆ ls()

list fs::ls ( string  path,
*string  regex,
*softint  reopts,
*string  encoding 
)
inline

lists files in the given directory

Parameters
paththe path to list
regexan optional regex to filter the results
reoptsoption regular expression options; see Regular Expression Constants for possible values
encodingthe encoding of the filesystem string data
Returns
a list of StatInfo file status value hashes for each matched file plus a "name" key with the file or directory name and optionally a "link" key for symbolic link targets
Exceptions
DIR-ERRORdirectory does not exist

◆ ls_conn()

list fs::ls_conn ( string  conn,
*string  path,
*string  regex,
*softint  reopts,
*string  encoding 
)
inline

lists files in the given directory

Parameters
connan user connection name
paththe path to list, relative to conn. It can be empty, then the toplevel connection directory is listed.
regexan optional regex to filter the results
reoptsoption regular expression options; see Regular Expression Constants for possible values
encodingthe encoding of the filesystem string data
Returns
a list of StatInfo file status value hashes for each matched file plus a "name" key with the file or directory name and optionally a "link" key for symbolic link targets
Exceptions
CONNECTION-ERRORthe given connection is not known
DIR-ERRORdirectory does not exist
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection

◆ rename()

nothing fs::rename ( string  source,
string  target,
softbool  man = False 
)
inline

rename/move a file

Parameters
sourcethe source path
targetthe target path
manrename the file manually by copying the file's data and then deleting the source file, this is sometimes necessary on some OSes when renaming files across filesystem boundaries

If any errors occur, an exception is thrown

Exceptions
RENAME-ERRORcannot stat() source file

◆ rename_conn()

nothing fs::rename_conn ( string  conn_src,
string  source,
string  conn_tgt,
string  target,
softbool  man = False 
)
inline

rename/move a file

Parameters
conn_srcthe source user connection name
sourcethe source path, relative to conn_src
conn_tgtthe target user connection name
targetthe target path, relative to conn_tgt
manrename the file manually by copying the file's data and then deleting the source file, this is sometimes necessary on some OSes when renaming files across filesystem boundaries

If any errors occur, an exception is thrown

Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
RENAME-ERRORcannot stat() source file

◆ write_file()

nothing fs::write_file ( string  path,
data  data,
int  mode = 0664,
*string  encoding 
)
inline

writes the input data to the given location

Parameters
paththe path of the file to write
datathe file data to write
modethe file's creation mode
encodingthe encoding of the target file

◆ write_file_conn()

nothing fs::write_file_conn ( string  conn,
string  path,
data  data,
int  mode = 0664,
*string  encoding 
)
inline

writes the input data to the given location

Parameters
conna user connection
paththe path of the file to write, relative to conn
datathe file data to write
modethe file's creation mode
encodingthe encoding of the target file
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection

The documentation for this class was generated from the following file: