Product Information > JADE Encyclopaedia of Classes – Volume 1 > Chapter 1 - System Classes > extractToFile

extractToFile

extractToFile(fileName:     String;
              allowReplace: Boolean);

The extractToFile method of the JadeBytes class extracts the binary content of the receiver to the file specified by the value of the fileName parameter, which must be a valid file name for the host machine executing the method.

The value of the allowReplace parameter determines whether an existing file with the same name can be replaced.

If the logical length of the receiver is zero, the output file is not created.

The following example shows the use of the extractToFile method.

vars
    bytes : JadeBytes;
begin
    create bytes;
    bytes.setContent("JADE".Binary);
    bytes.extractToFile("c:\example.txt", true);
epilog
    delete bytes;
end;