Global.helma.File.readAll ()
Sourcecode in /home/hannes/helma/modules/helma/File.js:
330:   this.readAll = function() {
331:         // Open the file for readAll
332:         if (self.isOpened()) {
333:            setError(new IllegalStateException("File already open"));
334:            return null;
335:         }
336:         try { 
337:            if (file.exists()) {
338:               readerWriter = new BufferedReader(new FileReader(file));
339:           } else {
340:              setError(new IllegalStateException("File does not exist"));
341:              return null;
342:           }
343:           if (!file.isFile()) {
344:              setError(new IllegalStateException("File is not a regular file"));
345:              return null;
346:           }
347:        
348:           // read content line by line to setup proper eol
349:           var buffer = new java.lang.StringBuffer(file.length() * 1.10);
350:           while (true) {
351:              var line = readerWriter.readLine();
352:              if (line == null)
353:                 break;
354:              if (buffer.length() > 0)
355:                 buffer.append("\n");  // EcmaScript EOL
356:              buffer.append(line);
357:           }
358:       
359:           // Close the file
360:           readerWriter.close();
361:           readerWriter = null;
362:           return buffer.toString();
363:        } catch (e) {
364:           readerWriter = null;
365:           setError(e);
366:           return null;
367:        }
368:     }