Whitebeam Object Definition

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Whitebeam Object Definition

Method Description

Binary.open()

Open a file or directory

Syntax

void = Binary.open(filename, mode)

Parameters

The 'Binary.open' method takes 2 parameters:

Name Type/Value Range/Length Description
filenamestring  Required. The name of the file or directory to open
modenumber  Optional, default = modeRead
How to open this file

Results

The 'Binary.open' method returns no useful information.

Remarks

This method opens a named file or directory. The default location for the file is in the file space for the current virtual server.

Directories are treated like files - and one openned successive calls to 'readln' will return the name of one file within the directory

The only mode under which a directory can be opennned is for reading.

Values for the 'mode' parameter are available as attributes on the binary object itself. This is best illustrated by example:

            <rb:script>
              var fileObj = new Binary;

              if (fileObj.open('/myfile.txt',fileObj.modeWrite)) {
                fileObj.writeln("Hello World");
              }
            </rb:script>
          

The mode value is a bitwise 'OR' of one or more of the following flags:

  • obj.modeRead open for reading (the default)
  • obj.modeWrite open for writing. Contents of the file are over-written.
  • obj.modeAppend open for writing. New data is written to the end of the existing file.
  • obj.modeBinary If this flag is set then the file is openned in binary mode and no newline processing takes place.

Note that the model for the system supports multiple underlying file systems.

Whitebeam release 1.3.36
(loadtime : 27ms)