Global.helma.File.hardCopy (dest)
function makes a copy of a file over partitions

  • Parameter StringOrFile:
    full path of the new file
Sourcecode in /home/hannes/helma/modules/helma/File.js:
417:   this.hardCopy = function(dest) {
418:         var inStream = new java.io.BufferedInputStream(
419:            new java.io.FileInputStream(file)
420:         );
421:         var outStream = new java.io.BufferedOutputStream(
422:            new java.io.FileOutputStream(dest)
423:         );
424:         var buffer = java.lang.reflect.Array.newInstance(
425:            java.lang.Byte.TYPE, 4096
426:        );
427:        var bytesRead = 0;
428:        while ((bytesRead = inStream.read(buffer, 0, buffer.length)) != -1) {
429:           outStream.write(buffer, 0, bytesRead);
430:        }
431:        outStream.flush();
432:        inStream.close();
433:        outStream.close();
434:        return true;
435:     }