Next: FileUtil
Up: simlib
Previous: FileNameClass
FileStatus
NAME
filestatus - routines to access Unix filesystem info about a
file.
DESCRIPTION
This class contains operations to read the Unix filesystem
information about a file such as type and creation date.
EXAMPLE
ref(FileStatus) FileInfo;
Text Filename;
FileInfo:-new FileStatus;
if FileInfo.SetFile(Filename) then
begin
outtext( Size in Bytes:");
outint(FileInfo.FileSize,0); outimage;"
end;
AUTHOR
Boris Magnusson, Lund University.
DETAILED INTERFACE
BitFiddleClass class FileStatus;
Access file system info of a file, such as type and creation
date.
Supers: BitFiddleClass
Kind: Instantiable
Init: call SetFile before other methods.
Sequencing: (SetFile
(Device / Inode / Protection / FileType / HardLinks/
OwnerUserId /
OwnerGroupId / DeviceType / FileSize / LastAccessTime /
LastModifyTime /
LastStatusChange / OptimalBlockSize / BlockAllocated)* )*
OPERATIONS
SetFile
boolean procedure SetFile(fname);
text fname; ! Full name of file to look up.;
Fill this object with nformation regarding 'fname'. Future
calls to other routiens of this class will return values
regarding this file until SetFile is called again.
Returns false if file 'fname' is not found.
Device
integer procedure Device;
Return the 'device' attribute.
Inode
integer procedure Inode;
Return the 'Inode' attribute of the file.
Protection
integer procedure Protection;
Return the 12 file 'protection' bits
FileType
integer procedure FileType;
returning an integer, with one of the following values
(pre-defined constants):
FIFO= fifo ;
FCHR= character special ;
FDIR= directory ;
FBLK= block special ;
FREG= regular ;
FLNK= symbolic link ;
FSOCK= socket ;
These constants are avialable as attributes of this class.
Soft links are reported as links (rather than as the file
they denote).
HardLinks
integer procedure HardLinks;
How many hard links to this file.
OwnerUserId
integer procedure OwnerUserId;
User Id of file owner.
OwnerGroupId
integer procedure OwnerGroupId;
Group Id of file owner.
DeviceType
integer procedure DeviceType;
Device Type of filesystem hosting the file (types=?).
FileSize
integer procedure FileSize;
Size of the file in bytes.
LastAccessTime
integer procedure LastAccessTime;
in seconds since year 0, 1970, Jan 1st.
LastModifyTime
integer procedure LastModifyTime;
in seconds since year 0, 1970, Jan 1st.
LastStatusChange
integer procedure LastStatusChange;
in seconds since year 0, 1970, Jan 1st.
OptimalBlockSize
integer procedure OptimalBlockSize;
BlockAllocated
integer procedure BlockAllocated;
Size of file in disk blocks.