Four classes (
Directory) allow you to create files and access the file system
in a fully object-oriented way.
FileStream are much more powerful than the
corresponding C language facilities (the difference between the two is that,
like the C
FileStream does buffering). For one
thing, they allow you to write raw binary data in a portable endian-neutral
format. But, more importantly, these classes transparently implement
virtual filesystems and asynchronous I/O.
Asynchronous I/O means that an input/output operation blocks the
Smalltalk Process that is doing it, but not the others, which makes them
very useful in the context of network programming. Virtual file systems
mean that these objects can transparently extract files from archives
such as tar and gzip files, through a mechanism that can
be extended through either shell scripting or Smalltalk programming.
For more information on these classes, look in the class reference, under
VFS namespace. URLs may be used as file names; though,
unless you have loaded the
NetClients package (see Network support),
file URLs will be accepted.
In addition, the three files,
are declared as global instances of
FileStream that are bound to the
proper values as passed to the C virtual machine. They can be accessed as
FileStream stdout—the former is easier to
type, but the latter can be clearer.
Object defines four other methods:
storeNl. These do a
storeOn: to the “Transcript” object; this object, which is the sole
instance of class
TextCollector, normally delegates write
stdout. If you load the Blox gui, instead,
the Transcript Window will be attached to the Transcript object (see Blox).
fileIn: message sent to the FileStream class, with a file
name as a string argument, will cause that file to be loaded into
FileStream fileIn: 'foo.st' !
will cause foo.st to be loaded into gnu Smalltalk.