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.
File(filepath) deprecated use helma.File instead
Constructor for File objects, providing read and write access to the file system.
Example:

    var fileOrDir = new File('static/test.txt');

parameters

String | filepath | as String

methods

- getName()

- getParent()

- isAbsolute()

- write(data)

- remove()

- list(pattern)

- flush()

- writeln(data)

- close()

- getPath()

- open()

- error(Object)

- canRead()

- canWrite()

- exists()

- getAbsolutePath()

- getLength()

- isDirectory()

- isFile()

- lastModified()

- mkdir()

- renameTo(dest)

- eof()

- isOpened()

- readln()

- clearError()

- readAll()

see

helma.File

Methods
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

File. getParent()
Returns the pathname string of this File object's parent directory.
returns

| String containing the pathname of the parent directory

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

File. write(data)
Appends a string to the file represented by this File object.
parameters

String | data | as String, to be written to the file

returns

| Boolean

see

File.writeln

File. remove()
Deletes the file or directory represented by this File object.
returns

| Boolean

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

File. flush()
Purges the content of the file represented by this File object.
returns

| Boolean

File. writeln(data)
Appends a string with a platform specific end of line to the file represented by this File object.
parameters

String | data | as String, to be written to the file

returns

| Boolean

see

File.write

File. close()
Closes the file represented by this File object.
returns

| Boolean

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

File. open()
Opens the file represented by this File object.
returns

| Boolean

File. error(Object)
Contains the last error that occured, if any.
parameters

| Object |

returns

| String

see

File.clearError

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

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.

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

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

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

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

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

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

File. mkdir()
Creates the directory represented by this File object.
returns

| Boolean true if the directory was created; false otherwise

File. renameTo(dest)
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 | dest | as FileObject of the new path

returns

| true if the renaming succeeded; false otherwise

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

File. isOpened()
Returns true if the file represented by this File object is currently open.
returns

| Boolean

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

File. clearError()
Clears any error message that may otherwise be returned by the error method.
see

File.error

File. readAll()
This methods reads all the lines contained in the file and returns them.
returns

| String of all the lines in the file

Tue, 25 Nov 2008 16:50:10 GMT.

### core framework

- global
- app (application)
- req (request)
- res (response)
- session
- path
- root
- HopObject
- User
- File
- FtpClient
- Image
- Mail
- Remote
- Xml
- DatabaseObject
- MimePart
- Skin
- Object

### optional modules

- Array extensions
- Date extensions
- Number extensions
- Object extensions
- String extensions
- HopObject extensions
- global macros
- macro filters
- JSON methods
- helma.Aspects
- helma.Chart
- helma.Color
- helma.Database
- helma.File
- helma.Ftp
- helma.Group
- helma.Html
- helma.Http
- helma.Image
- helma.Mail
- helma.Search
- helma.Skin
- helma.Ssh
- helma.Url
- helma.Zip
- jala.BitTorrent
- jala.Captcha
- jala.Date
- jala.db
- jala.DnsClient
- jala.Form
- jala.History
- jala HopObject extensions
- jala.HtmlDocument
- jala.I18n
- jala.ImageFilter
- jala.IndexManager
- jala.ListRenderer
- jala.Mp3
- jala.PodcastWriter
- jala.RemoteContent
- jala.Rss20Writer
- jala.Utilities
- jala.XmlRpcRequest
- jala.XmlWriter

### java libraries

- browse docjar