Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Default properties and methods of the File prototype.

To use this optional module, its repository needs to be added to the application, for example by calling app.addRepository('modules/helma/File.js')
helma File(path)
Constructor for File objects, providing read and write access to the file system.
parameters
String path as String, can be either absolute or relative to the helma home directory
methods
Methods
helma.File. getName()
Returns the name of the file or directory represented by this File object.

This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned.
returns
String containing the name of the file or directory
helma.File. isOpened()
Returns true if the file represented by this File object is currently open.
returns
Boolean
helma.File. open(options)
Opens the file represented by this File object. If the file exists, it is used for reading, otherwise it is opened for writing. If the encoding argument is specified, it is used to read or write the file. Otherwise, the platform's default encoding is used.
parameters
Object options an optional argument holder object. The following options are supported:
  • charset name of encoding to use for reading or writing
  • append whether to append to the file if it exists
returns
Boolean true if the operation succeeded
helma.File. exists()
Tests whether the file or directory represented by this File object exists.
returns
Boolean true if the file or directory exists; false otherwise
helma.File. getParent()
Returns the pathname string of this File object's parent directory.
returns
String containing the pathname of the parent directory
helma.File. readln()
This methods reads characters until an end of line/file is encountered then returns the string for these characters (without any end of line character).
returns
String of the next unread line in the file
helma.File. write(what)
Appends a string to the file represented by this File object.
parameters
String what as String, to be written to the file
returns
Boolean
see
helma.File. writeln(what)
Appends a string with a platform specific end of line to the file represented by this File object.
parameters
String what as String, to be written to the file
returns
Boolean
see
helma.File. isAbsolute()
Tests whether this File object's pathname is absolute.

The definition of absolute pathname is system dependent. On UNIX systems, a pathname is absolute if its prefix is "/". On Microsoft Windows systems, a pathname is absolute if its prefix is a drive specifier followed by "\\", or if its prefix is "\\".
returns
Boolean if this abstract pathname is absolute, false otherwise
helma.File. remove()
Deletes the file or directory represented by this File object.
returns
Boolean
helma.File. list(pattern)
List of all files within the directory represented by this File object.

You may pass a RegExp Pattern to return just files matching this pattern.

Example: var xmlFiles = dir.list(/.*\.xml/);
parameters
RegExp pattern as RegExp, optional pattern to test each file name against
returns
Array the list of file names
helma.File. flush()
Purges the content of the file represented by this File object.
returns
Boolean
helma.File. close()
Closes the file represented by this File object.
returns
Boolean
helma.File. getPath()
Returns the pathname string of this File object.

The resulting string uses the default name-separator character to separate the names in the name sequence.
returns
String of this file's pathname
helma.File. error()
Contains the last error that occured, if any.
returns
String
see
helma.File. clearError()
Clears any error message that may otherwise be returned by the error method.
see
helma.File. canRead()
Tests whether the application can read the file represented by this File object.
returns
Boolean true if the file exists and can be read; false otherwise
helma.File. canWrite()
Tests whether the file represented by this File object is writable.
returns
Boolean true if the file exists and can be modified; false otherwise.
helma.File. getAbsolutePath()
Returns the absolute pathname string of this file.

If this File object's pathname is already absolute, then the pathname string is simply returned as if by the getPath() method. If this abstract pathname is the empty abstract pathname then the pathname string of the current user directory, which is named by the system property user.dir, is returned. Otherwise this pathname is resolved in a system-dependent way. On UNIX systems, a relative pathname is made absolute by resolving it against the current user directory. On Microsoft Windows systems, a relative pathname is made absolute by resolving it against the current directory of the drive named by the pathname, if any; if not, it is resolved against the current user directory.
returns
String The absolute pathname string
helma.File. getLength()
Returns the length of the file represented by this File object.

The return value is unspecified if this pathname denotes a directory.
returns
Number The length, in bytes, of the file, or 0L if the file does not exist
helma.File. isDirectory()
Tests whether the file represented by this File object is a directory.
returns
Boolean true if this File object is a directory and exists; false otherwise
helma.File. isFile()
Tests whether the file represented by this File object is a normal file.

A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.
returns
Boolean true if this File object is a normal file and exists; false otherwise
helma.File. lastModified()
Returns the time when the file represented by this File object was last modified.

A number representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs.
returns
Number in milliseconds since 00:00:00 GMT, January 1, 1970
helma.File. makeDirectory()
Creates the directory represented by this File object.
returns
Boolean true if the directory was created; false otherwise
helma.File. renameTo(toFile)
Renames the file represented by this File object.

Whether or not this method can move a file from one filesystem to another is platform-dependent. The return value should always be checked to make sure that the rename operation was successful.
parameters
FileObject toFile as FileObject of the new path
returns
true if the renaming succeeded; false otherwise
helma.File. eof()
Returns true if the file represented by this File object has been read entirely and the end of file has been reached.
returns
Boolean
helma.File. readAll()
This methods reads all the lines contained in the file and returns them.
returns
String of all the lines in the file
helma.File. removeDirectory()
This method removes a directory recursively .

DANGER! DANGER! HIGH VOLTAGE! The directory is deleted recursively without any warning or precautious measures.
helma.File. listRecursive(pattern)
Recursivly lists all files below a given directory you may pass a RegExp Pattern to return just files matching this pattern.
parameters
RegExp pattern as RegExp, to test each file name against
returns
Array the list of absolute file paths
helma.File. hardCopy(dest)
Makes a copy of a file over partitions.
parameters
String, helma.File dest as a File object or the String of full path of the new file
helma.File. move(dest)
Moves a file to a new destination directory.
parameters
String dest as String, the full path of the new file
returns
Boolean true in case file could be moved, false otherwise
helma.File. toByteArray()
Returns file as ByteArray.

Useful for passing it to a function instead of an request object.
Fri, 05 Feb 2010 17:40:05 GMT.

core framework

optional modules

java libraries

properties files