Associating Files With Devices
By using the runtime configuration file’s <file-associations> option element, it is possible to associate specific
files with specific devices. This is accomplished with the <device-configuration> element within the
<file-association> element.
The format of the device configuration element is:
<file-associations>
<file-association>
<external-name>the actual path or command to be used for the device("default" default)</external-name>
<device-configuration>
<option key="access-type" value="the means of accessing this device (FILE default)"/>
<option key="suppress-trailing-spaces" value="true or false (false default)"/>
<option key="line-delimiter-is-flexible" value="true or false (false default)"/>
<option key="use-cr" value="true or false (true default)"/>
<option key="use-ff" value="true or false (true default)"/>
<option key="line-delimiter" value="CR|LF|CRLF|NL|SYSTEM (Default)"/>
<option key="raw-print" value="true or false (true default)"/>
<option key="mime-type" value="the mime type of the data to be written (application/octet-steam default)"/>
<option key="charset" value="the character set (charset) of the data to be read/written (null default)"/>
</device-configuration>
</file-association>
</file-associations>The options are used as follows:
Device Configuration
access-type
| Option | Description |
|---|---|
FILE | In the case of a print file, the external-name refers to the name of a printer or print spooler accessible in the Java program environment. If not specified the default print device will be used (or if "default" is specified for the option). If the PROCESS option is used, the value of the external-name is an operating system shell command that will be executed in a spawned process to establish a source/sink for data directed to this device. If the FILE option is used (or access-type not specified), but the external-name is present and the string value begins with the "|" character, a named pipe with a name corresponding to the balance of the string value of the path option will be used as the source/sink of this device. |
PROCESS | If specified, the external-name describes a command to be started in another process to serve as a source/sink of data for this device. |
SPOOL | If set the sequential file to be "spooled" to a print queue designated by the value of the external-name. A temporary file will be allocated and used while the file is open for output, and then released to the Java print spooler when the file is closed or the program terminates. |
use-cr
If set to true or omitted allows the sequential file connector to use the "carriage return" character in the native charset to return the print position to the first column of a line without causing the line to advance. If omitted or set to false, the file connector will not use the carriage return character, but will assume that the position of characters within a line is sequential and cannot be changed.
use-ff
If set to true or omitted allows the sequential file connector to use the "form feed" character in the native charset to cause the line to advance to the next physical page. If set to false the file connector will not use the form feed character to accomplish this.
line-delimiter
This determines the line termination of each LINE SEQUENTIAL record written. The default value of SYSTEM will use the normal line termination used by editors on the runtime environment system.
line-delimiter-is-flexible
If set to true specifies that any contiguous sequence of line delimiter characters or reaching the maximum record length should terminate reading of a line sequential record. A long record condition (04) will never be indicated in this mode. If set to false (the default) it specifies that only the designated line-delimiter should be considered a line termination and that upon reaching the maximum record length for a file, any additional characters up to and including a subsequent line-delimiter are to be discarded and a long record status (04) indicated.
suppress-trailing-spaces
If set to true specifies that for line sequential organization files all output records should have trailing spaces (in the native character set) removed and that upon input all records should be padded on the right with spaces to the maximum record length for the file. If set to false (the default), output records are not altered and upon input records shorter than the minimum record size should be padded on the right with spaces to the minimum record size.
raw-print
If set to true or omitted and SPOOL is specified, this causes the file connector to treat the record delimiter as
"NONE", omitting any line sequential record termination that might otherwise be added to records written. If set to
false, record delimiter of LINE_SEQUENTIAL is used.
mime-type
May be used to specify the mime-type of spooled output, which may be used by the print spooling system to choose or
control the destination printing device. If not specified and spool-print is in effect, a mime-type of
"application/octet-stream" will be used by default.
charset
May be used to specify the Java charset of the spooled output, which may be used by the print spooling system to choose or control the destination printing device. If not specified the charset will be considered unknown at print time, with whatever consequences that has depending on the print device.
See also Configuring File Associations for more information on this.