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.append()

Append the contents of one binary object onto another

Syntax

binary = Binary.append(sourceObj)

Parameters

The 'Binary.append' method takes 1 parameter:

Name Type/Value Range/Length Description
sourceObjbinary  Required. A binary object to be appended to the current binary object

Results

The 'Binary.append' method returns binary:

Type/Value Range/Length Description
binary  

Remarks

This method copies the content of another binary object onto this one.

This method can be used to reconstruct a single binary object from a set of 'slices' created using the 'slice' metnhod.

Note that JavaScript itself doesn't handle binary objects so these methods are the only sensible way of splitting and reconstructing binary data.

See the binary object technical note for details

Example

Assuming we have one big file spread over a set of template files - your can reconstruct the big file as follows:

function buildFile(arrayFileIDs) {
  var bigFile = new Binary;
  for (var i=0;i<arrayFileIDs;i++) {
    var it = rb.file.get({fileID:arrayFileIDs[i]});
    if (it.getNextRow())
      bigFile.append(it.fileDef);
  }
  return bigFile;
}

Note however that this is not particularly efficient in the case where the file is simply being written out to the client. In this case it's easier simply to stream out the contents as follows:

function sendFile(arrayFileIDs) {
  for (var i=0;i<arrayFileIDs;i++) {
    var it = rb.file.get({fileID:arrayFileIDs[i]});
    if (it.getNextRow())
      rb.page.writeraw(it.fileDef);
  }
}
Whitebeam release 1.3.36
(loadtime : 11ms)