table of contents
sio(3) | AFNIX Module | sio(3) |
NAME¶
sio - standard input/output moduleSTANDARD INPUT/OUTPUT MODULE¶
The Standard Input/Output module is an orginal implementation that provides objects for i/o operations. Although input and output files are the standard objects that one might expect, the module facilities for directory access, path manipulation and i/o event management. At the heart of this module is the concept of stream associated with the transcoding object which enable the passage between one coding system to another. It is also this module which provides the stream selector object. Input and output streamsCodeset | Description |
DEFAULT | Default codeset, i.e US-ASCII |
ISO-01 | ISO-8859-1 codeset |
ISO-02 | ISO-8859-2 codeset |
ISO-03 | ISO-8859-3 codeset |
ISO-04 | ISO-8859-4 codeset |
ISO-05 | ISO-8859-5 codeset |
ISO-06 | ISO-8859-6 codeset |
ISO-07 | ISO-8859-7 codeset |
ISO-08 | ISO-8859-8 codeset |
ISO-09 | ISO-8859-9 codeset |
ISO-10 | ISO-8859-10 codeset |
ISO-11 | ISO-8859-11 codeset |
ISO-13 | ISO-8859-13 codeset |
ISO-14 | ISO-8859-14 codeset |
ISO-15 | ISO-8859-15 codeset |
ISO-16 | ISO-8859-16 codeset |
UTF-08 | Unicode UTF-8 codeset |
# try to read 256 bytes const buf (is:read 256) # get the buffer size println (buf:length) # get a string representation println (buf:to-string)File stream
# load the module interp:library "afnix-sio" # create an input file by name const if (afnix:sio:InputFile "orig.txt") # create an output file by name const of (afnix:sio:OutputFile "copy.txt")Stream information
println (if:get-name) println (of:get-name)Predicates are also available for these classes. The input-file-p returns true for an input file object.The output-file-p returns true for an output file object.
afnix:sio:input-stream-p if afnix:sio:output-stream-p of afnix:sio:input-file-p if afnix:sio:output-file-p ofReading and writing
# load the module and open the files interp:library "afnix-sio" const if (afnix:sio:InputFile "orig.txt") const of (afnix:sio:OutputFile "copy.txt") # loop in the input file and write while (if:valid-p) (of:write (if:read))The use of the readln method can be more effective. The example below is a simple cat program which take the file name an argument.
# cat a file on the output terminal # usage: axi 0601.als file # get the io module interp:library "afnix-sio" # cat a file const cat (name) { const f (afnix:sio:InputFile name) while (f:valid-p) (println (f:readln)) f:close } # get the file if (== 0 (interp:argv:length)) { errorln "usage: axi 0601.als file" } { cat (interp:argv:get 0) }Multiplexing
# create a selector const slt (afnix:sio:Selector is) # at this stage the selector has one stream # the add method can add more streams slt:add osThe add method adds a new stream to the selector. The stream must be either an InputStream and OutputStream stream or an exception is raised. If the stream is both an input and an output stream, the preference is given to the input stream. If this preference is not acceptable, the input-add or the output-add methods might be preferable. The input-length method returns the number of input streams in this selector. The output-length method returns the number of output streams in this selector. The input-get method returns the selector input stream by index. The output-get method returns the selector output stream by index. Waiting for i/o event
# wait for a status change const is (slt:wait) # is is ready for reading - make sure it is an input one if (afnix:sio:input-stream-p is) (is:read)A call to the wait method will always returns the first input stream. Marking mode
const term (Terminal) term:set-primary-prompt "demo:" const line (term:read-line) errorln lineUsing the error terminal
# cat a file on the error terminal # get the io module interp:library "afnix-sio" # cat a file const cat (name es) { const f (afnix:sio:InputFile name) while (f:valid-p) (es:writeln (f:readln)) f:close }Directory
# print the current directory const pwd (afnix:sio:Directory) println (pwd:get-name)Once the directory object is opened, it is possible to list its contents. The get-list method returns the full contents of the directory object. The get-files method returns a list of files in this directory. The get-subdirs method returns a list of sub directories in this directory.
# print a list of files const pwd (afnix:sio:Directory) const lsf (d:get-files) for (name) (lsf) (println name)Creating and removing directories
const tmp (afnix:sio:Directory ( afnix:sio:absolute-path "tmp")) const exp (tmp:mkdir "examples") const lsf (exp:get-files) println (lsf:length) tmp:rmdir "examples"The function absolute-path constructs an absolute path name from the argument list. If relative path needs to be constructed, the function relative-path might be used instead. Logtee
# create a logger with the interpreter stream const log (Logtee (interp:get-output-stream)) assert true (logger-p log)Adding messages
log:add 2 "a level 2 message"The set-tee method sets the control flag. The set-report-level method sets the report level. Note that the set-report-level and its associated get-report-level method is part of the base Logger class. Path name
# create a new path name const path (afnix:sio:Pathname "axi")Adding a directory path
# adding a directory path const name (afnix:sio:absolute-path "usr" "bin") path:set-directory-name nameGetting the path information
STANDARD INPUT/OUTPUT REFERENCE¶
Transcodertranscoder-p
Inheritance
Object
Constants
DEFAULT
The DEFAULT constant is used by the set-transcoding-mode method to specify the
class transcoding mode. In default mode, each character is not transcoded.
This mode is the identity mode.
I8859-01
The I8859-01 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-6 codeset.
I8859-02
The I8859-02 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-2 codeset.
I8859-03
The I8859-03 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-3 codeset.
I8859-04
The I8859-04 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-4 codeset.
I8859-05
The I8859-05 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-5 codeset.
I8859-06
The I8859-06 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-6 codeset.
I8859-07
The I8859-07 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-7 codeset.
I8859-08
The I8859-08 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-8 codeset.
I8859-09
The I8859-09 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-9 codeset.
I8859-10
The I8859-10 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-10 codeset.
I8859-11
The I8859-11 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-11 codeset.
I8859-13
The I8859-13 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-13 codeset.
I8859-14
The I8859-14 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-14 codeset.
I8859-15
The I8859-15 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-15 codeset.
I8859-16
The I8859-16 constant is used by the set-transcoding-mode method to specify the
class transcoding mode that corresponds to the ISO-8859-16 codeset.
Constructors
Transcoder (none)
The Transcoder constructor creates a default transcoder that operates in default
mode by using the identity function.
Transcoder (constant)
The Transcoder constructor creates a transcoder with the argument mode.
Methods
set-transcoding-mode -> none (constant)
The set-transcoding-mode method sets the class transcoding mode.
get-transcoding-mode -> constant (none)
The get-transcoding-mode method returns the class transcoding mode.
valid-p -> Byte|Character (Boolean)
The valid-p predicate returns true if character can be transcoded. If the
argument is a byte, the method returns true if the byte can be transcoded to a
character. If the argument is a character, the method returns true if the
character can be transcoded to a byte.
encode -> Byte (Character)
The encode method encodes a byte into a character. If the character cannot be
encoded, an exception is raised.
decode -> Character (Byte)
The decode method decodes a character into a byte. If the character cannot be
decoded, an exception is raised.
Stream
stream-p
Inheritance
Transcoder
Constants
BYTE
The BYTE constant is used by the set-coding-mode method to specify the stream
coding mode. In byte mode, each character is assumed to be coded with one
byte. This value affects the getu and write methods
UTF-8
The UTF-8 constant is used by the set-coding-mode method to specify the stream
coding mode. In UTF-8 mode, each character is assumed to be coded in the UTF-8
representation. This value affects the getu and write methods
Methods
set-encoding-mode -> none (constant|String)
The set-encoding-mode method sets the stream coding mode that affects how
characters are read or written. In the enumeration form, the method only sets
the stream coding mode which is either byte or UTF-8 mode. In the string mode,
the method sets the stream encoding mode and the transcoding mode.
get-encoding-mode -> constant (none)
The get-coding-mode method returns the stream coding mode which affects how
characters are read or written.
InputStream
input-stream-p
Inheritance
Stream
Methods
flush -> none|Character (none)
The flush method the input stream buffer. In the first form, without argument,
the input stream buffer is entirely flushed. In the second form, the input
stream buffer is flushed until the character argument is found.
get-timeout -> Integer (none)
The get-timeout method returns the input stream timeout. A negative value is a
blocking timeout.
set-timeout -> none (Integer)
The set-timeout method sets the input stream timeout. A negative value is a
blocking timeout. Changing the stream timeout does not cancel any pending read
operation.
read -> Byte (none)
The read method returns the next byte available from the input stream. If the
stream has been closed or consumed, the end-of-stream byte is returned.
read -> Buffer (Integer)
The read method returns a buffer object with at most the number of bytes
specified as an argument. The buffer length method should be used to check how
many bytes have been placed in the buffer.
readln -> String (none)
The readln method returns the next line available from the input stream. If the
stream has been closed or consumed, the end-of-stream character is
returned.
getu -> Character (none)
The getu method returns the next available Unicode character from the input
stream. If the stream has been closed or consumed, the end-of-stream character
is returned. During the read process, if the character decoding operation
fails, an exception is raised.
valid-p -> Boolean (none|Integer)
The valid-p method returns true if the input stream is in a valid state. By
valid state, we mean that the input stream can return a byte with a call to
the read method. With one argument, the method timeout after the specified
time in milliseconds. If the timeout is null, the method returns immediately.
With -1, the method blocks indefinitely if no byte is available.
eos-p -> Boolean (none)
The eos-p predicate returns true if the input stream has been closed or all
bytes consumed.
pushback -> Integer (Byte|Character|String)
The pushback method push-back a byte, an Unicode character or a string in the
input stream. Subsequent calls to read will return the last pushed bytes.
Pushing a string is equivalent to push each encoded bytes of the string. The
method returns the number of bytes pushed back.
get-buffer-length -> Integer (none)
The get-buffer-length method returns the length of the push-back buffer.
to-string -> String (none)
The to-string method returns a string representation of the input stream
buffer.
InputFile
input-file-p
Inheritance
InputStreamNameable
Constructors
InputFile (String)
The InputFile constructor create an input file by name. If the file cannot be
created, an exception is raised. The first argument is the file name to
open.
InputFile (String String)
The InputFile constructor create an input file by name and encoding mode. If the
file cannot be created, an exception is raised. The first argument is the file
name to open.The second argument is the encoding mode to use.
Methods
close -> Boolean (none)
The close method close the input file and returns true on success, false
otherwise. In case of success, multiple calls return true.
lseek -> none (Integer)
The lseek set the input file position to the integer argument. Note that the
push-back buffer is reset after this call.
length -> Integer (none)
The length method returns the length of the input file. The length is expressed
in bytes.
get-modification-time -> Integer (none)
The get-modification-time method returns the modification time of the file. The
returned argument is suitable for the Time and Date system classes.
InputMapped
input-mapped-p
Inheritance
InputStream
Constructors
InputMapped (none)
The InputMapped constructor create a null input stream. This stream acts as a
null character generator.
InputMapped (String|Buffer)
The InputMapped constructor create a mapped input stream by name or buffer. In
the first form, a string is used as file name to be mapped an input stream. In
the second form, a buffer is mapped as an input stream.
InputMapped (String Integer Integer)
The InputMapped constructor create a mapped input stream by name, size and
offset. The string argument is the file name to map. The second argument is
the desired mapped size. The third argument is the offset inside the file
before mapping it.
Methods
lseek -> none (Integer)
The lseek set the input mapped file position to the integer argument. Note that
the push-back buffer is reset after this call.
length -> Integer (none)
The length method returns the length of the input mapped file. The length is
expressed in bytes.
InputString
input-string-p
Inheritance
InputStream
Constructors
InputString (none)
The InputString constructor creates an empty input string.
InputString (String)
The InputString constructor creates an input string by value.
Methods
get -> Byte (none)
The get method returns the next available byte from the input stream but do not
remove it.
set -> none (String)
The set method sets the input string by first resetting the push-back buffer and
then initializing the input string with the argument value.
InputTerm
input-term-p
Inheritance
InputStreamOutputStream
Constructors
InputTerm (none)
The InputTerm constructor creates a default input terminal.
Methods
set-ignore-eos -> none (Boolean)
The set-ignore-eos method set the input terminal end-of-stream ignore flag. When
the flag is on, any character that match a ctrl-d is changed to the
end-of-stream mapped character returned by a read. This method is useful to
prevent a reader to exit when the ctrl-d byte is generated.
set-mapped-eos -> none (Byte)
The set-mapped-eos method set the input terminal end-of-stream mapped character.
By default the character is set to end-of-line. This method should be used in
conjunction with the set-ignore-eos method.
OutputStream
output-stream-p
Inheritance
Stream
Methods
write -> Integer (Literal+)
The write method write one or more literal arguments on the output stream. This
method returns the number of characters written.
writeln -> none (Literal+)
The writeln method write one or more literal argument to the output stream and
finish with a newline. This method return nil.
errorln -> none (Literal+)
The errorln method write one or more literal argument to the associated output
error stream and finish with a newline. Most of the time, the output stream
and error stream are the same except for an output terminal.
newline -> none (none)
The newline method writes a new line byte to the output stream. The method
returns nil.
write-soh -> none (none)
The write-soh method writes a start-of-heading character to the output
stream.
write-stx -> none (none)
The write-stx method writes a start-of-transmission character to the output
stream.
write-etx -> none (none)
The write-etx method writes an end-of-transmission character to the output
stream.
write-eos -> none (none)
The write-eos method writes an end-of-stream character to the output
stream.
OutputFile
output-file-p
Inheritance
OutputStreamNameable
Constructors
OutputFile (String)
The OutputFile constructor create an output file by name. If the file cannot be
created, an exception is raised. The first argument is the file name to
create.
OutputFile (String String)
The OutputFile constructor create an output file by name and encoding mode. If
the file cannot be created, an exception is raised. The first argument is the
file name to create. The second argument is the encoding mode to use.
OutputFile (String Boolean Boolean)
The OutputFile constructor create an output file by name. If the file cannot be
created, an exception is raised. The first argument is the file name to
create. The second argument is the truncate flag. If the file already exists
and the truncate flag is set, the file is truncated to 0. The third argument
is the append mode. If set to true, the file is open in append mode.
Methods
close -> Boolean (none)
The close method closes the output file and returns true on success, false
otherwise. In case of success, multiple calls returns true.
OutputString
output-string-p
Inheritance
OutputStream
Constructors
OutputString (none)
The OutputString constructor creates a default output string.
OutputString (String)
The OutputString constructor creates an output string by value. The output
string stream is initialized with the string value.
Methods
flush -> none (none)
The flush method flushes the output stream by resetting the stream buffer.
length -> Integer (none)
The length method returns the length of the output string buffer.
to-string -> String (none)
The to-string method returns a string representation of the output string
buffer.
OutputBuffer
output-buffer-p
Inheritance
OutputStream
Constructors
OutputBuffer (none)
The OutputBuffer constructor creates a default output buffer.
OutputBuffer (String)
The OutputBuffer constructor creates an output buffer by value. The output
buffer stream is initialized with the string value.
Methods
flush -> none (none)
The flush method flushes the output stream by resetting the stream buffer.
length -> Integer (none)
The length method returns the length of the output buffer.
to-string -> String (none)
The to-string method returns a string representation of the output buffer.
format -> String (none)
The format method returns an octet string representation of the output
buffer.
OutputTerm
output-term-p
Inheritance
OutputStream
Constructors
OutputTerm (none)
The OutputTerm constructor creates a default output terminal
ErrorTerm (none)
The ErrorTerm constructor creates a default error terminal
Terminal
terminal-p
Inheritance
InputTermOutputTerm
Constructors
Terminal (none)
The Terminal constructor creates a default terminal which combines an input and
output terminal with line editing capabilities.
Methods
set-primary-prompt -> none (String)
The set-primary-prompt method sets the terminal primary prompt which is used
when the read-line method is called.
set-secondary-prompt -> none (String)
The set-secondary-prompt method sets the terminal secondary prompt which is used
when the read-line method is called.
get-primary-prompt -> String (none)
The get-primary-prompt method returns the terminal primary prompt.
get-secondary -> String (none)
The get-secondary-prompt method returns the terminal secondary prompt.
Intercom
intercom-p
Inheritance
Object
Constructors
Intercom (none)
The Intercom constructor creates a default interpreter communication object.
There is no stream attached to it.
Intercom (InputStream|OutputStream)
The Intercom constructor creates an interpreter communication object with an
input or an output stream. In the first form, the input stream object is used
by the recv method to read data object. In the second form, the output stream
object is used by the send method to send data object.
Intercom (InputStream OutputStream)
The Intercom constructor creates an interpreter communication object with an
input and an output stream.
Methods
send -> none (Object)
The send method serialize the object argument with the help of the output stream
bound to the interpreter communication object. If there is no output stream,
nothing is sent.
recv -> Object (none)
The recv method deserialize an object with the help of the input stream bound to
the interpreter communication object. If there is no output stream, nil is
returned.
request -> Object (Object)
The request method perform an atomic send receive operation.
set-input-stream -> none (InputStream)
The set-input-stream method binds an input stream to the interpreter
communication object.
get-input-stream -> InputStream (none)
The get-input-stream method returns the input stream bound to the interpreter
communication object.
set-output-stream -> none (OutputStream)
The set-output-stream method binds an output stream to the interpreter
communication object.
get-output-stream -> OutputStream (none)
The get-output-stream method returns the output stream bound to the interpreter
communication object.
InputOutput
input-output-p
Inheritance
InputStreamOutputStream
Constructors
InputOutput (none)
The InputOutput constructor creates a default input/output stream.
InputOutput (String)
The InputOutput constructor creates an input/output stream initialized with the
string argument. The string argument is used to fill the string buffer.
Methods
get -> Byte (none)
The get method returns the next available byte from the input stream but do not
remove it.
set -> none (String)
The set method sets the input string by first resetting the push-back buffer and
then initializing the input string with the argument value.
Selector
selector
Inheritance
Object
Constructors
Selector (none)
The Selector constructor creates a default stream selector.
Selector ([Boolean] [InputStream|OutputStream]*)
The Selector constructor creates a stream selector with 0 or more stream
arguments. If the first argument is a boolean, the selector is constructed
marked mode.
Methods
add -> none (InputStream|OutputStream)
The add method adds an input or output stream to the selector. If the stream is
both an input and an output stream, the preference is given to the input
stream. If this preference is not acceptable, the input-add or the output-add
methods might be preferable.
input-add -> none (InputStream)
The input-add method adds an input stream to the selector.
output-add -> none (OutputStream)
The output-add method adds an output stream to the selector.
wait -> Stream (none|Integer)
The wait method waits for a status change in the selector and returns the first
stream that has change status. With one argument, the selector time-out after
the specified time in milliseconds. Note that at the time of the return,
several streams may have changed status.
wait-all -> Vector (none|Integer)
The wait method waits for a status change in the selector and returns all
streams that has change status in a vector object. With one argument, the
selector time-out after the specified time in milliseconds. If the selector
has timed-out, the vector is empty.
input-get -> InputStream (Integer)
The input-get method returns the input streams in the selector by index. If the
index is out of bound, an exception is raised.
output-get -> OutputStream (Integer)
The output-get method returns the output streams in the selector by index. If
the index is out of bound, an exception is raised.
input-length -> Integer (none)
The input-length method returns the number of input streams in the
selector.
output-length -> Integer (none)
The output-length method returns the number of output streams in the
selector.
mark -> none (none)
The mark method marks a selector object.
marked-p -> Boolean (none)
The marked-p predicate returns true if the selector has been marked.
Logtee
logtee-p
Inheritance
Logger
Constructors
Logtee (none)
The Logtee constructor creates a default logger without an output stream.
Logtee (Integer)
The Logtee constructor creates a logger with a specific size without an output
stream. terminal
Logtee (OutputStream)
The Logtee constructor creates a logger with an output stream. The object is
initialized to operate in write mode.
Logtee (Integer OutputStream)
The Logtee constructor creates a logger with a specific size with an output
stream. The first argument is the logger size. The second argument is the
output stream.
Logtee (Integer String OutputStream)
The Logtee constructor creates a logger with a specific size, an information
string and an output stream. The first argument is the logger size. The second
argument is information string. The third argument is the output stream.
Methods
set-tee-stream -> none (OutputStream)
The set-tee-stream method sets the tee output stream. This stream is different
from the logger output stream
get-tee-stream -> OutputStream (none)
The get-tee-stream method returns the object output stream.
set-tee -> none (Boolean)
The set-tee method sets the object tee flag. When the flag is true, the logger
writes the added message on the output stream.
get-tee -> Boolean (none)
The get-tee method returns the object tee flag. When the flag is true, the
logger writes the added message on the output stream.
Pathname
pathname-p
Inheritance
Object
Constructors
Pathname (none)
The Pathname constructor creates a default path name without file and directory
names.
Pathname (String)
The Pathname constructor creates a path name with a file name. The first string
argument is the file name.
Pathname (String String)
The Pathname constructor creates a pathname with a file and directory name. The
first string argument is the file name. The second string argument is the
directory name.
Methods
reset -> none (none)
The reset method reset the path name by removing all path and file
information.
dir-p -> Boolean (none)
The dir-p predicate returns true if the path is a directory.
file-p -> Boolean (none)
The file-p predicate returns true if the path is a file.
set-file-name -> none (String)
The set-file-name method set the path name file name. The string argument is the
file name.
get-file-name -> String (none)
The get-file-name method returns the path name file name.
add-directory-name -> none (String)
The add-directory-name method add the directory name to the directory path
component. The string argument is the directory name.
set-directory-name -> none (String)
The set-directory-name method set the directory name file name. The string
argument is the directory name.
get-directory-name -> String (none)
The get-directory-name method returns the path name directory name.
length -> Integer (none)
The length method returns the number of directory path elements.
get-path -> String (Integer)
The get-path method returns a directory path element by index.
get-root -> String (none)
The get-root method returns the root component of a directory name.
get-full -> String (none)
The get-full method returns the full path name by combining the directory name
with the file name.
add-path -> none (String)
The add-path method add a new path component by name. The path is separated into
individual component and added to the directory path unless it is a root path.
If the file name is set, the file name is added as a directory component. If
the path is a root path, a new path name is rebuilt. This last case is
equivalent to a call to set-file-name.
normalize -> none (none)
The normalize method rebuild the path name by determining the full path nature
if possible. In case of success, the path structure reflects the actual path
type.
Pathlist
pathlist-p
Inheritance
Object
Constructors
Pathlist (none)
The Pathlist constructor creates a default path list.
Pathlist (Boolean|String)
The Pathlist constructor creates a path list with a local search flag or with an
initial path component. In the first form, a boolean argument controls the
local search flag. In the second for, a string argument is used as the initial
path component.
Methods
reset -> none (none)
The reset method resets the path list by clearing the local search flag and
removing all path components.
local-p -> Boolean (none)
The local-p predicate returns true if the local search flag is set.
set-local-search -> none (Boolean)
The set-local-search method sets the local search flag.
length -> Integer (none)
The length method returns the number of directory path elements.
get-path -> String (Integer)
The get-path method returns a directory path element by index.
add-path -> none (String)
The add-path method add a new path component by name. The string argument is the
name to add.
file-p -> Boolean (String)
The file-p predicate returns true if the file name argument can be resolved. If
the local search flag is set, the local directory is check first.
resolve -> String (String)
The resolve method returns a string representation of the resolved file path. If
the local search flag is set and the file name is found locally, the initial
name argument is returned.
Functions
dir-p -> Boolean (String)
The dir-p function returns true if the argument name is a directory name, false
otherwise.
file-p -> Boolean (String)
The file-p function returns true if the argument name is a regular file name,
false otherwise.
tmp-name -> String (String?)
The tmp-name function returns a name suitable for the use as a temporary file
name. Without argument, a default prefix is used to build the name. An
optional string prefix can control the original name.
tmp-path -> String (String?)
The tmp-path function returns a path suitable for the use as a temporary file
name. Without argument, a default prefix is used to build the path. An
optional string prefix can control the original name.
absolute-path -> String (String+)
The absolute-path function returns an absolute path name from an argument list.
Without argument, the command returns the root directory name. With one or
several argument, the absolute path is computed from the root directory.
relative-path -> String (String+)
The relative-path function returns a relative path name from an argument list.
With one argument, the function returns it. With two or more arguments, the
relative path is computed by joining each argument with the previous
one.
rmfile -> none (String+)
The rmfile function removes one or several files specified as the arguments. If
one file fails to be removed, an exception is raised.
mkdir -> none (String+)
The mkdir function creates one or several directories specified as the
arguments. If one directory fails to be created, an exception is raised.
mhdir -> none (String+)
The mhdir function creates hierarchically one or several directories specified
as the arguments. If one directory fails to be created, an exception is
raised.
rmdir -> none (String+)
The rmdir function removes one or several directories specified as the
arguments. If one directory fails to be removed, an exception is raised.
get-base-name -> String (String)
The get-base-name function returns the base name from a path. The base name can
be either a file name or a directory name. By definition, a path is made of a
base path and a base name.
get-base-path -> String (String)
The get-base-path function returns the base path from a path. The base path is a
directory name. By definition, a path is made of a base path and a base
name.
get-extension -> String (String)
The get-extension function returns the extension from a path.
remove-extension -> String (String)
The remove-extension function returns the extension from a path. In order to get
a base file name from a path, the get-base-name function must be called
first.
Directory
directory-p
Inheritance
Object
Constructors
Directory (none)
The Directory constructor creates a directory object those location is the
current directory. If the directory cannot be opened, an exception is
raised.
Directory (String)
The Directory constructor create a directory object by name. If the directory
cannot be opened, an exception is raised. The first argument is the directory
name to open.
Methods
mkdir -> Directory (String)
The mkdir method creates a new directory in the current one. The full path is
constructed by taking the directory name and adding the argument. Once the
directory is created, the method returns a directory object of the newly
constructed directory. An exception is thrown if the directory cannot be
created.
rmdir -> none (String)
The rmdir method removes an empty directory. The full path is constructed by
taking the directory name and adding the argument. An exception is thrown if
the directory cannot be removed.
rmfile -> none (String)
The rmfile method removes a file in the current directory. The full path is
constructed by taking the directory name and adding the argument. An exception
is thrown if the file cannot be removed.
get-name -> String (none)
The get-name method returns the directory name. If the default directory was
created, the method returns the full directory path.
get-list -> List (none)
The get-list method returns the directory contents. The method returns a list of
strings. The list contains all valid names at the time of the call, including
the current directory and the parent directory.
get-files -> List (none)
The get-files method returns the directory contents. The method returns a list
of strings of files. The list contains all valid names at the time of the
call.
get-subdirs -> List (none)
The get-subdirs method returns the sub directories. The method returns a list of
strings of sub-directories. The list contains all valid names at the time of
the call, including the current directory and the parent directory.
next-name -> String (none)
The next-name method returns the next available name from the directory stream.
This method is useful when operating with a large number of elements.
next-path -> String (none)
The next-path method returns the next available path name from the directory
stream. This method is useful when operating with a large number of
elements.
next-file-name -> String (none)
The next-file-name method returns the next available file name from the
directory stream. This method is useful when operating with a large number of
elements.
next-file-path -> String (none)
The next-file-path method returns the next available file path name from the
directory stream. This method is useful when operating with a large number of
elements.
next-dir-name -> String (none)
The next-dir-name method returns the next available directory name from the
directory stream. This method is useful when operating with a large number of
elements.
next-dir-path -> String (none)
The next-dir-path method returns the next available directory path name from the
directory stream. This method is useful when operating with a large number of
elements.
Logtee
logtee-p
Inheritance
Logger
Constructors
Logtee (none)
The Logtee constructor creates a default logger without an output stream
Logtee (Integer)
The Logtee constructor creates a logger object with a specific size without an
output stream.
Logtee (Output)
The Logtee constructor creates a logger object with an output stream.
Logtee (Integer Output)
The Logtee constructor creates a logger object with a specific size and an
output stream. The first argument is the logger window size. The second
argument is the output stream.
Logtee (Integer String Output)
The Logtee constructor creates a logger object with a specific size, an
information string and an output stream. The first argument is the logger
window size. The second argument is the logger information string. The third
argument is the output stream.
Methods
set-output-stream -> none (Output)
The set-output-stream method attaches the output stream to the logtee
object.
get-output-stream -> Output (none)
The get-output-stream method returns the logtee output stream.
set-tee -> none (Boolean)
The set-tee method sets the logtee control flag. The control flag controls the
message display to the output stream.
get-tee -> Boolean (none)
The get-tee method returns the logtee output stream.
NamedFifo
named-fifo-p
Inheritance
StrvecNameable
Constructors
NamedFifo (none)
The NamedFifo constructor creates a default named fifo without a backing name.
In this case the fifo cannot be read or written by stream.
NamedFifo (String)
The NamedFifo constructor creates a named fifo by name. The name is used as a
file name for reading or writing the fifo.
NamedFifo (String Boolean)
The NamedFifo constructor creates a named fifo by name. The name is used as a
file name for reading or writing the fifo.If the boolean argument is true, the
fifo is read.
Methods
read -> none (none)
The read method reads the fifo file name and fill the fifo.
write -> none (none)
The write method writes the fifo contents to the fifo file name.
set-name -> none (String)
The set-name method sets the fifo file name.
FileInfo
file-info-p
Inheritance
Nameable
Constructors
(String)
The FileInfo constructor creates a file information by name. The string argument
is the file name to query.
Methods
length -> Integer (none)
The length method returns the file size information.
get-modification-time -> Integer (none)
The get-modification-time method returns the file modification time. The time
can be used as an argument to the Time or Date object.
update -> none (none)
The update method the file information data.
2012-03-26 | AFNIX |