ObjectTalk Classes

Below is the reference documentation for all classes included in the ObjectTalk runtime.

Object Class

ObjectTalk uses single inheritance to simplify the language and every class must be derived from another class. The only exception to this rule is the Object class as it provides the foundation for all objects. As such, all ObjectTalk classes are derived (directly or indirectly) from Object. The Object class is the only class without a parent class.

Given that the Object class is very abstract, it is not very meaningful to instantiate it. Off course there is an exception here as well as the default global context creates a null object that can be used to denote a value that does not exist.

var a = null;
var b = Object();
assert(a == b);

In the example above, both a and b have the same (non) value.

All ObjectTalk objects have a special mechanism to store members that can be accessed with the dot (member) operator. Members are not preserved beyond the running of a script and should therefore not be used as a dictionary. For that, please of the Dict class. Members are powerful as any data can be attached to an object.

When members are retrieved, the ObjectTalk engine for looks at the members attached to the object and if it can't be found, it's class and parent classes are searched. This is actually the mechanism by which class member functions are found.

var a = -1;
a.flag = true;            // attach member to object a
assert(a.flag == true);
assert(a.abs() == 1);     // abs member function from Integer class

Integer.flag2 = false;    // set member on Integer class
assert(a.flag2 == false); // find member in Integer object

This power however comes with a disadvantage as you can create really obscure code. Here is an example:

var a = "test";
var b = "test";
a.flag = true;            // only set member on object a

a.dosomething = function(this) {
	return "I did it";
};                        // store a function as a member

assert(a.flag == true);
assert(a.dosomething() == "I did it");

var result = false;
var c = "";

try {
	c = b.dosomething();  // this won't work as b does not have members
}

catch error {
	result = true;        // we expected this error
}

assert(result == true);
assert(c == "");

String.flag2 = true;      // add member to String class

String.dosomething = function(this) {
	return "I did it";
};                        // add function to String class

// now the member is available on all String objects
assert(a.flag2 == true);
assert(b.flag2 == true);
assert(a.dosomething() == "I did it");
assert(b.dosomething() == "I did it");

Member Functions

Function Description
boolean() Convert object to a boolean. This is a virtual function that child classes must overwrite if required. By default, this function returns false.
integer() Convert object to an integer. This is a virtual function that child classes must overwrite if required. By default, this function returns 0.
real() Convert object to a real. This is a virtual function that child classes must overwrite if required. By default, this function returns 0.0.
string() Convert object to a string. This is a virtual function that child classes must overwrite if required. By default, this function returns "".
json() Represent object in JSON format. This is a virtual function that child classes must overwrite if required. By default, this function returns the string representation.
has(name) See if object has named member.
set(name, value) Set the value of a named member.
get(name) Get the value of a named member.
unset(name) Remove named member.
unsetAll() Remove all named members.
__member__(name) Return a MemberReference object to acces an object's named member. This member function is called when you use the member (.) operator. You typically don't call this member function directly.
__eq__(object) See if objects are equal. This virtual member function is called when you use the equal (==) operator and should be overwritten when required. You typically don't call this member function directly.
__ne__(object) See if objects are not equal. This virtual member function is called when you use the not equal (!=) operator and should be overwritten when required. You typically don't call this member function directly.
getClass() return the object's class.
isKindOf(className) See if object is derived from specified class.

Primitive Class

The Primitive class is an abstract class without any functionality derived from Object. The purpose of it in ObjectTalk is simply to group all primitive classes and to provide a common base class for them.

Booleans, Integers, Reals, Strings and Functions are derived from this class.

Boolean Class

Booleans in ObjectTalk can only hold two values: true and false. The default global language context defines the variables true and false as a convenience.

Member Functions

Function Description
__and__(boolean) Perform a logical and with the boolean representation of the operand. This member function is called when you use the and (&&) operator.
__or__(boolean) Perform a logical or with the boolean representation of the operand. This member function is called when you use the or (||) operator.
__not__() Take truth to falsity and vice versa. This member function is called when you use the not (!) operator.

Overrides

The Boolean class overrides the following member functions from the Object class:

  • boolean
  • integer
  • real
  • string
  • __eq__
  • __ne__

Integer Class

Integers in ObjectTalk represent negative and positive whole numbers. On most systems, this number is implemented as a 64-bit number meaning that the extremes are -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (inclusive).

Member Functions

Function Description
__gt__(integer) Compares integer to the object's value and returns a boolean indicating whether the object's value is greater than the integer or not. This member function is called when you use the greater than (>) operator.
__lt__(integer) Compares integer to the object's value and returns a boolean indicating whether the object's value is less than the integer or not. This member function is called when you use the less than (<) operator.
__ge__(integer) Compares integer to the object's value and returns a boolean indicating whether the object's value is greater or equal than the integer or not. This member function is called when you use the greater or equal than (>=) operator.
__le__(integer) Compares integer to the object's value and returns a boolean indicating whether the object's value is less or equal than the integer or not. This member function is called when you use the less or equal than (<=) operator.
__add__(integer) Add integer to object's value and return result. This member function is called when you use the add (+) operator.
__sub__(integer) Subtract integer from object's value and return result. This member function is called when you use the subtract (-) operator.
__mul__(integer) Multiple integer with object's value and return result. This member function is called when you use the multiply (*) operator.
__div__(integer) Divide object's value by integer and return result. This member function is called when you use the divide (/) operator.
__mod__(integer) Divide object's value by integer and return leftover. This member function is called when you use the modulo (%) operator.
__pow__(integer) Raise object's value to the power of integer and return result. This member function is called when you use the exponent (**) operator.
__inc__() Return object's value + 1. This member function is called when you use the increment (++) operator.
__dec__() Return object's value - 1. This member function is called when you use the decrement (--) operator.
__lshift__(integer) Shift bits in object's value left by integer and return result. This member function is called when you use the shift left (<<) operator.
__rshift__(integer) Shift bits in object's value right by integer and return result. This member function is called when you use the shift right (>>) operator.
__band__(integer) Perform a bitwise logical AND between object's value and integer and return result. This member function is called when you use the bitwise and (&) operator.
__bor__(integer) Perform a bitwise logical OR between object's value and integer and return result. This member function is called when you use the bitwise or (
__bxor__(integer) Perform a bitwise logical exclusive OR between object's value and integer and return result. This member function is called when you use the bitwise exclusive or (^) operator.
__bnot__() Perform logical negation of each bit in object's value and return result. This member function is called when you use the bitwise and (~) operator.
__neg__() Perform a unary negation of object's value and return result. This member function is called when you use the unary negation (-) operator.
abs() Return absolute value of object's value.
sign() Return sign (-1, 0 or 1) of object's value.
min(integer) Return the minimum of integer and the object's value.
max(integer) Return the maximum of integer and the object's value.
clamp(min, max) Return clamped value between min and max.
random() Return a non-cryptographic random number between 0 and the object's value.

Overrides

The Integer class overrides the following member functions from the Object class:

  • boolean
  • integer
  • real
  • string
  • __eq__
  • __ne__

Real Class

Reals in ObjectTalk are double-precision floating point numbers. On most systems, Reals are implemented using 8 bytes and have a range of 1.7E +/- 308 (15 digits).

Member Functions

Function Description
__gt__(real) Compares real to the object's value and returns a boolean indicating whether the object's value is greater than the integer or not. This member function is called when you use the greater than (>) operator.
__lt__(real) Compares real to the object's value and returns a boolean indicating whether the object's value is less than the integer or not. This member function is called when you use the less than (<) operator.
__ge__(real) Compares real to the object's value and returns a boolean indicating whether the object's value is greater or equal than the integer or not. This member function is called when you use the greater or equal than (>=) operator.
__le__(real) Compares real to the object's value and returns a boolean indicating whether the object's value is less or equal than the integer or not. This member function is called when you use the less or equal than (<=) operator.
__add__(real) Add real to object's value and return result. This member function is called when you use the add (+) operator.
__sub__(real) Subtract real from object's value and return result. This member function is called when you use the subtract (-) operator.
__mul__(real) Multiple real with object's value and return result. This member function is called when you use the multiply (*) operator.
__div__(real) Divide object's value by real and return result. This member function is called when you use the divide (/) operator.
__mod__(real) Divide object's value by real and return leftover. This member function is called when you use the modulo (%) operator.
__pow__(real) Raise object's value to the power of real and return result. This member function is called when you use the exponent (**) operator.
__neg__() Perform a unary negation of object's value and return result. This member function is called when you use the unary negation (-) operator.
abs() Return absolute value of object's value.
sign() Return sign (-1, 0 or 1) of object's value.
round() Returns integer that is nearest to object's value, with halfway cases rounded away from zero.
ceil() Rounds object's value upward, returning the smallest integral value that is not less than object's value.
floor() Rounds object's value downward, returning the largest integral value that is not greater than object's value.
trunc() Rounds object's value toward zero, returning the nearest integral value that is not larger in magnitude than object's value.
min(real) Return the minimum of real and the object's value.
max(real) Return the maximum of real and the object's value.
clamp(min, max) Return clamped value between min and max.
lerp(min, max) Return the linear interpolation between min and max based on value (as the ratio).
sin() Returns the sine of an angle of object's value in radians.
cos() Returns the cosine of an angle of object's value in radians.
tan() Returns the tangent of an angle of object's value in radians.
asin() Returns the principal value of the arc sine of object's value, expressed in radians.
acos() Returns the principal value of the arc cosine of object's value, expressed in radians.
atan() Returns the principal value of the arc tangent of object's value, expressed in radians.
atan2() Returns the principal value of the arc tangent expressed in radians of value/operand using the signs of arguments to determine the correct quadrant.
radians() Returns object's value converted from degrees to radians.
degrees() Returns object's value converted from radians to degrees.
sqrt() Return the square root of object's value.
pow(exp) Return the object's value raised to the power exp.
log() Return the natural (base-e) logarithm of object's value.
exp() Returns the base-e exponential function of object's value.
log10() Return the common (base-10) logarithm of object's value.
random() Return a non-cryptographic random number between 0.0 and the object's value.
toFixed(precision) Format object's value using fixed-point notation.

Overrides

The Real class overrides the following member functions from the Object class:

  • boolean
  • integer
  • real
  • string
  • __eq__
  • __ne__

String Class

Strings in ObjectTalk are sequences of characters and are captured in double quotes and can span multiple lines. Strings may contain UTF-8 characters (like "€") or use JSON style encoding like "Most Europeans like the \u00C4.\n".

Member Functions

Function Description
__gt__(string) Compares string to the object's value alphabetically and returns a boolean indicating whether the object's value is greater than the integer or not. This member function is called when you use the greater than (>) operator.
__lt__(string) Compares string to the object's value alphabetically and returns a boolean indicating whether the object's value is less than the integer or not. This member function is called when you use the less than (<) operator.
__ge__(string) Compares string to the object's value alphabetically and returns a boolean indicating whether the object's value is greater or equal than the integer or not. This member function is called when you use the greater or equal than (>=) operator.
__le__(string) Compares string to the object's value alphabetically and returns a boolean indicating whether the object's value is less or equal than the integer or not. This member function is called when you use the less or equal than (<=) operator.
casecmp(string) Compares string to the object's value alphabetically but case independently and returns an integer indicating whether the object's value is less, equal or greater than the string.
__index__(integer) Return a StringReference object to address individual characters in a string. This member function is called when you use the index ([]) operator. You typically don't call this member function directly.
__iter__() Return a StringIterator object to iterate through individual characters in a string. This member function is called when you use the for in statement. You typically don't call this member function directly.
__add__(string) Concatenates string to the object's value and returns result. This member function is called when you use the addition (+) operator.
__contains__(string) Determine if string is contained in objects value. This member function is called when you use the (not) in operators.
len() Return number of characters in object's value.
left(len) Return the left most number of characters in object's value. If number is higher than length of string, the entire string is returned.
right(len) Return the right most number of characters in object's value. If number is higher than length of string, the entire string is returned.
mid(pos, len) Return the portion of the object's value that starts at character position pos and spans len characters (or until the end of the string, whichever comes first).
find(string) Searches the object's value for the first occurrence of the specified string and return its position. If string is not found, -1 is returned.
startsWith(string) Determines if the object's value starts with the specified string. A Boolean is returned.
contains(string) Determines if the object's value contains the specified string. A Boolean is returned.
trim() Trim all whitespaces (SPACE, TAB, VTAB, CR, LF) from the start and the end of the object's value and return result.
ltrim() Trim all whitespaces (SPACE, TAB, VTAB, CR, LF) from the start of the object's value and return result.
rtrim() Trim all whitespaces (SPACE, TAB, VTAB, CR, LF) from the end of the object's value and return result.
compress() Trim all whitespaces (SPACE, TAB, VTAB, CR, LF) from the start and the end of the object's value, replace whitespace sequence in the middle with a single space and return result.
lower() Convert all characters in the object's value to lowercase and return result.
upper() Convert all characters in the object's value to uppercase and return result.
split(delimiter) Split string based on delimiter and return array of substrings.
format(parameters...) Format a string using the value as a mask and the parameters to substitute (like printf).

Overrides

The String class overrides the following member functions from the Object class:

  • boolean
  • integer
  • real
  • string
  • json
  • __eq__
  • __ne__

Function Class

Functions in ObjectTalk are primitive values. This means that we can pass a function around like any other primitive. Function are first class citizens in ObjectTalk.

In ObjectTalk, there are two types of functions: those that are mapped to machine level C or C++ code and those that are written in ObjectTalk. From a usage perspective there is no difference and both are called the same way, stored the same way and can be passed as arguments. The two examples below create the same result. In the first case, you see a traditional function declaration where as in the second case, an anonymous (lambda) function is assigned a variable.

function test() {
}

var test = function() {
};

Class member functions or "methods" in ObjectTalk are regular functions and the ObjectTalk compiler translates a perceived method call into a function call. In the example below the test member of an object is called with object as the first parameter. This is why member functions in their definition must have a first parameter that refers to the object. ObjectTalk does not care if you call that first member self, this or anything else. You can also see in the example that methods (member functions) can be declared in a traditional way or as lambda assignments.

object.test(p1, p2); becomes test(object, p1, p2);

class Test : Object {
	function test(this, p1, p2) {
	}

	function test2(self) {
	}

	var test3 = function(object) {
	}
}

Member Functions

Function Description
__call__(...) execute the function and return the result.

Collection Class

The Collection class is an abstract class without any functionality derived from Object. The purpose of it in ObjectTalk is simply to group all collection classes and to provide a common base class for them.

Arrays Dictionaries and Sets are derived from this class.

Array Class

Arrays are sequences of objects that can be constructed using square brackets ([]) or through the Array class constructor. The Array class has many member functions to manipulate the content of an array.

var array1 = [ 1, 2, "test", 7 + 4, a ];
var array2 = Array(3.14, 7, 34, 1);

array1.append("new value");
var thirdValue = array1[3];

var array3 = [3.14, [3, 5, 4], 34, 1];

Member Functions

Function Description
__init__(...) Construct an array. This member function is called when you use the execution [()] operator on the Array class. Every value passed to this function becomes a member of the new array. You typically don't call this member function directly.
__index__(integer) Return an ArrayReference object to address individual objects in an array. This member function is called when you use the index ([]) operator. You typically don't call this member function directly.
__iter__() Return an ArrayIterator object to iterate through objects in an array. This member function is called when you use the for in statement. You typically don't call this member function directly.
__add__(object) Append object to the array and return a new array. This member function is called when you use the addition (+) operator. If the object is another array, it will be added as a single member creating an array hierarchy. If you want to join two arrays, use the join member function.
__contains__(object) Determine if object is member of array.
size() Return number of objects in array.
find(object) Find object in array and return its position. If object is not found, -1 is returned.
contains(object) Determine if object is member of array. This member function is called when you use the (not) in operator. You typically don't call this member function directly.
clone() Return a clone of the array.
merge(array) Append array to object's value and return a new array.
clear() Clear (empty) the array.
append(object) Append object to array and return array.
insert(index, object) Insert object at specified location and return array.
erase(index) Remove object at specified location and return array.
eraseMultiple(from, to) Remove all objects between specified locations and return array.
sort() Sort array in ascending order and return array. Sort is performed in place.
rsort() Reverse sort array in ascending order and return array. Sort is performed in place.
csort(function) Sort array in an order controlled by a provided function. The function must take two parameters and return true if they are in the right order or false if they need to be reversed. Sort returns array and is performed in place.
push(object) Push object to array and return array. This is the same as append but makes it more logical if you use an array as a stack.
pop() Pop object from the end of the array allowing it to be used as a stack.
fill(count, object) Fill array with N copies of provided object and return array.
join(separator) Join array entries into a string with separator.

Overrides

The Array class overrides the following member functions from the Object class:

  • string

Dict Class

Dictionaries contain indexed key/value pairs that are constructed using curly brackets ({}) or through the Dict class constructor. The Dict class also has many member functions to manipulate the content of a dictionary.

var dict1 = [ "First Name": "John", "Last Name": "Doe", "Age": 34 };
var dict2 = Dict("Name", "John Doe", "Address", "Unknown");

dict1["Last Update"] = "1 Apr 2000";
var name = dict2["Name"];

Member Functions

Function Description
__init__(...) Construct a dictionary. This member function is called when you use the execution [()] operator on the Dict class. Every two parameters will become a dictionary entry. The first is the index and the second is the value. You typically don't call this member function directly.
__index__(string) Return a DictReference object to address individual objects in a dictionary. This member function is called when you use the index ([]) operator. You typically don't call this member function directly.
__add__(dict) Concatenates objects from the dictionary to this object's value and return a new dictionary. This member function is called when you use the addition (+) operator. In case there are duplicates, the entries in the operand will win. You typically don't call this member function directly.
__contains__(string) Determine if named object is member of dictionary. This member function is called when you use the (not) in operator. You typically don't call this member function directly.
size() Return number of objects in the dictionary.
contains(key) See if we have named object in dictionary.
merge() Merge two dictionaries and return a new one.
clone() Return a clone of the dictionary.
clear() Clear (empty) the dictionary.
erase(string) Remove the named object from the dictionary.
keys() Return an array with all the dictionary's keys.
values() Return an array with all the dictionary's values.

Overrides

The Dict class overrides the following member functions from the Object class:

  • string

Set Class

Sets store distinct values in a collection without defined order. You can use a set instead of an array when the order of items isn’t important, or when you need to ensure that an item only appears once. Sets can be created using the Set class constructor. The Set class also has many member functions to manipulate the content of a set or to perform set operations (e.g. union, difference).

var set = Set(1, 2, 3, 5);
var set2 = Set(1, 3, 6, 8);

assert(set.intersection(set2) == Set(1, 3));
assert(set.difference(set2) == Set(2, 5, 6, 8));
assert(set.union(set2) == Set(1, 2, 3, 5, 6, 8));
assert(set.subtract(set2) == Set(2, 5));

Member Functions

Function Description
__init__(...) Construct a Set. This member function is called when you use the execution [()] operator on the Set class. Every value passed to this member function becomes a member of the new set. You typically don't call this member function directly.
__iter__() Return a SetIterator object to iterate through objects in a set. This member function is called when you use the for in statement. You typically don't call this member function directly.
__add__(object) Add object to the set and return a new set. This member function is called when you use the addition (+) operator. If the object is another set, it will be added as a single member creating a set hierarchy. If you want to perform mathematical function on two sets use the intersection, difference, union and subtract functions.
__sub__(object) Remove object from the set and return a new set. This member function is called when you use the subtraction (-) operator.
__contains__(object) Determine if object is a member of the set. This member function is called when you use the (not) in operator. You typically don't call this member function directly.
size() Return number of objects in the set.
contains(object) Determine if object is a member of the set.
clone() Return a clone of the set.
merge() Merge two sets and return a new one.
clear() Clear (empty) the set.
add(object) Add object to the set.
erase(object) Remove object from the set.
intersection(set) Return a new set with only the values common to both sets.
difference(set) Return a new set with values in either set, but not both.
union(set) Return a new set with all of the values in both sets.
subtract(set) Return a new set with values not in the specified set.

Overrides

The Set class overrides the following member functions from the Object class:

  • string

System Class

The System class is an abstract class without any functionality derived from Object. The purpose of it in ObjectTalk is simply to group all operating and file system classes.

Path Class

Objects of type path represent paths on a filesystem. A path name has the following syntax:

  • root-name (optional): identifies the root on a filesystem with multiple roots (such as "C:" or "//myserver"). In case of ambiguity, the longest sequence of characters that forms a valid root-name is treated as the root-name.
  • root-directory (optional): a directory separator that, if present, marks this path as absolute. If it is missing (and the first element other than the root name is a file name), then the path is relative and requires another path as the starting location to resolve to a file name.
  • Zero or more of the following:
    • file-name: sequence of characters that aren't directory separators or preferred directory separators (additional limitations may be imposed by the OS or file system). This name may identify a file, a hard link, a symbolic link, or a directory. Two special file-names are recognized:
      • dot: the file name consisting of a single dot character . is a directory name that refers to the current directory
      • dot-dot: the file name consisting of two dot characters .. is a directory name that refers to the parent directory.
    • directory-separators: the forward slash character / or the alternative character provided by the operating system. If this character is repeated, it is treated as a single directory separator: /usr///////lib is the same as /usr/lib.

Member Functions

Function Description
__init__(...) Construct a filesystem Path by combining all provided directories. An operating system directory separator is automatically inserted.
__add__(operand) Concatenate two paths without introducing a directory separator.
__div__(operand) Append elements to the path with a directory separator.
__iter__() Return a PathIterator object to iterate through the directories in a path. This member function is called when you use the for in statement. You typically don't call this member function directly.
clear() Erase the contents of the path.
exists() See if the path exists on this system.
isAbsolute() Check whether the path is absolute.
isRelative() Check whether the path is relative.
isEmpty() Check if the path is empty.
relative(operand) Return relative path from operand.
directory() Return the parent path.
filename() Return the filename.
extension() Return the file extension.
rootDirectory() Return the root directory.
rootName() Return the root name.
rootPath() Return the root path.
stem() Return the stem (filename without the final extension).
removeFilename() Remove the filename component.
replaceExtension() Replace the file extension.
replaceFilename() Replace the filename.
hasExtension() Check if the extension element of the path is not empty.
hasFilename() Check if the filename element of the path is not empty.
hasParentPath() Check if the parent element of the path is not empty.
hasRelativePath() Check if the relative path element of the path is not empty.
hasRootDirectory() Check if the root directory element of the path is not empty.
hasRootName() Check if the root name element of the path is not empty.
hasRootPath() Check if the root path element of the path is not empty.
hasStem() Check if the stem element of the path is not empty.

Overrides

The String class overrides the following member functions from the Object class:

  • string
  • __eq__
  • __ne__

OS Class

The OS (Operating System) class encapsulates an interface to the native operating system. Filesystem operations are not included as they are covered by the FS (File System) class. The Global scope predefines an OS instance under the name os.

Member Functions

Function Description
clock() Return the number of seconds since the epoch as a floating point number.
cores() Return an array of dictionaries giving details about the CPUs cores.
networks() Return an array of dictionaries giving details about the network connections.
totalMemory() Get the total available memory on this machine (in bytes).
freeMemory() Get the amount of free memory available in the system (in bytes).
getDay() Get the day in the month (1-31).
getDayOfWeek() Get the day of the week (0-6). Sunday is day 0.
getDayOfYear() Get day of the year (1-366).
getHours() Get hours (0-23).
getMinutes() Get minutes (0-59).
getMonth() Get month (1-12).
getSeconds() Get seconds (0.59).
getYear() Get year.
isDST() Is daylight savings time active.
getenv(name) Get value of named environment variable.
hasenv(name) See if named environment variable exists.
setenv(name, value) Set named environment variable to provided value.
unsetenv(name) Remove the named environment variable.
hostname() Return the computer's hostname.
machine() Return the hardware identification for the system.
sysname() Return the Operating System name.
release() Return the Operating System release.
version() Return the Operating System version.
uuid() Return a Universally Unique Identifier (UUID).
sleep() Causes the calling thread to sleep for a specified number of milliseconds.
uptime() Return the systems uptime in seconds.
runServer() Run the event loop for a server app.
stopServer() Stop the event loop for a server app.
runGUI() Run the event loop for a GUI app.
stopGUI() Stop the event loop for a GUI app.

FS Class

The FS (File System) class encapsulates an interface to the native file system.

Member Functions

Function Description
capacity() Return the total amount of space on the current file system in bytes.
available() Return the amount of available space on the current file system in bytes.
free() Return the amount of free space on the current file system in bytes.
gethome() Return the current user's home directory.
getcwd() Return the current working directory.
chdir(path) Set the current working directory to specified path.
gettmp() Return the path the the system's temporary directory.
tmpnam() Return path for a temporary file.
mktmpdir() Create a temporary directory and return path.
filesize(file) Return the size of the specified file in bytes.
cp(from, to) Copy filesystem object represented by a path (file or directory) to a new location. If object is a directory, the copy will be recursive.
mv(from, to) Move filesystem object represented by a path (file or directory) to a new location.
mkdir(path) Create a new directory. Parent path must exist.
mkdirs(path) Create a new directory and all the intermediate directories if required.
ln(from, to) Link a file system object to a new path.
lns(from, to) symbolically link a file system object to a new path.
ls(directory) Return an array of file system object names contains in specified directory.
resize(file, newSize) Change the size of the file: if the file size was previously larger than newSize, the remainder of the file is discarded. If the file was previously smaller than newSize, the file size is increased and the new area appears as if zero-filled.
rm(file) Delete the specified file.
rmdir(directory) Delete the specified directory. If the directory is not empty, this operation will fail.
rmdirs(directory) Delete the specified directory and its content recursively.
touch(file) Touch a file by updating its last access time without changing the contents.