kind

Type: Integer

The kind property of the File class contains the kind of file that is to be opened.

File class constants are provided for the types of file, as listed in the following table.

Constant Value Description
Kind_ANSI 2 ANSI text file (default for ANSI JADE)
Kind_Binary 1 Binary file
Kind_Unicode 3 Unicode text file (default for Unicode JADE)
Kind_Unicode_UTF16BE 5 Unicode Transformation Format (UTF) 16-bit, big-endian
Kind_Unicode_UTF16LE 6 Unicode Transformation Format (UTF) 16-bit, little-endian
Kind_Unicode_UTF32BE 9 Unicode Transformation Format (UTF) 32-bit, big-endian
Kind_Unicode_UTF32LE 10 Unicode Transformation Format (UTF) 32-bit, little-endian
Kind_Unicode_UTF8 8 Unicode Transformation Format (UTF) 8 bit
Kind_Unknown_Text 4 Not known if file is ANSI or Unicode (the value is set when the file is opened)

If the kind property is not one of these types when the file is opened, an exception is raised.

In the big-endian variant of the UTF 16-bit and 32-bit formats, the high byte precedes the low byte. Conversely, the low byte precedes the high byte in the little-endian UTF 16-bit and 32-bit formats.

A Unicode text file (that is, the kind property has a File class constant value of Kind_Unicode) behaves the same as the Kind_Unicode_UTF16LE value.

JADE handles the Kind_Unicode constant by defaulting to the wide-character (UTF 16 or UTF 32) little-endian or big-endian format, as defined for the process operating system. Use the UTF constant values only if you want to enforce the Unicode output format.

As the output to the kind of file fails if you use one of the UTF constant values to enforce specific coding requirements and the format is incompatible with the operating system in which the process is running, you should use the Kind_Unicode constant in most cases and let JADE handle the format for you.

The following example shows how to determine the kind of a text file.

vars
    file : File;
begin
    create file transient;
    file.kind := File.Kind_Unknown_Text;
    file.openInput("C:\temp\words.txt");
    write file.kind;
epilog
    delete file;
end;