Read - Function Summary
Reads from a file, url, or port-spec (block or object).
source - The source argument. (must be: file url object block)
/binary - Preserves contents exactly.
/string - Translates all line terminators.
/direct - Opens the port without buffering.
/no-wait - Returns immediately without waiting if no data.
/lines - Handles data as lines.
/part - Reads a specified amount of data.
size - The size argument. (must be: number)
/with - Specifies alternate line termination.
end-of-line - The end-of-line argument. (must be: char string)
/mode - Block of above refinements.
args - The args argument. (must be: block)
/custom - Allows special refinements.
params - The params argument. (must be: block)
/skip - Skips a number of bytes.
length - The length argument. (must be: number)
Using READ is the simplest way to get information from a file or URL. This is a higher level port operation that opens a port, reads some or all of the data, then closes the port and returns the data that was read. When used on a file, or URL, the contents of the file, or URL are returned as a string.
The /BINARY refinement forces READ to do a binary read. When used on a text file, line terminators will not be converted.
The /STRING refinement translates line terminators to the operating system's line terminator. This behavior is default.
The /DIRECT refinement reads without buffering, useful for reading files too large to contain in memory.
The /LINES refinement returns read content as a series of lines. One line is created for each line terminator found in the read data.
The /PART refinement reads the specified number of elements from the file, URL, or port. Reading a file or URL will read the specified number of characters. Used with /LINES, it reads a specified number of lines.
The /WITH refinement converts characters, or strings, specified into line terminators.
See the User's Guide for more detailed explanation of using READ and its refinements.
close - Closes an open port connection.