Qore Programming Language Reference Manual 1.16.0
Loading...
Searching...
No Matches
QC_ReadOnlyFile.dox.h
1
3namespace Qore {
5
24
25public:
27
40int close();
41
42public:
44
67 constructor(string path, *string encoding);
68
69public:
71
77
78public:
80
83
84public:
86
96string getEncoding();
97
98public:
100
112*string getFileName();
113
114public:
116
130int getPos();
131
132public:
134
147*string getchar();
148
149public:
151
167hash<StatInfo> hstat();
168
169public:
171
188bool isDataAvailable(timeout timeout_ms = 0);
189
190public:
192
202bool isOpen();
203
204public:
206
218bool isTty();
219
220public:
222
247nothing open(string path, *string encoding);
248
249public:
251
279*string read(softint size, timeout timeout_ms = -1);
280
281public:
283
310*binary readBinary(softint size, timeout timeout_ms = -1);
311
312public:
314
339*string readLine(bool incl_eol = True, *string eol);
340
341public:
343
356*int readi1();
357
358public:
360
373*int readi2();
374
375public:
377
391
392public:
394
407*int readi4();
408
409public:
411
425
426public:
428
441*int readi8();
442
443public:
445
459
460public:
462
475*int readu1();
476
477public:
479
492*int readu2();
493
494public:
496
510
511public:
513
526*int readu4();
527
528public:
530
544
545public:
547
556nothing setEncoding(*string encoding);
557
558public:
560
576nothing setEventQueue(Queue queue, auto arg, *bool with_data);
577
578public:
580
590
591public:
593
606int setPos(int pos = 0);
607
608public:
610
626list<auto> stat();
627
628public:
630
646hash<FilesystemInfo> statvfs();
647
648public:
650
672static hash<StatInfo> hlstat(string path);
673
674public:
676
697static hash<StatInfo> hstat(string path);
698
699public:
701
723static list<auto> lstat(string path);
724
725public:
727
749static binary readBinaryFile(string path, int max_file_len = -1);
750
751public:
753
778static string readTextFile(string path, *string encoding, int max_file_len = -1);
779
780public:
782
803static list<auto> stat(string path);
804
805public:
807
829static hash<FilesystemInfo> statvfs(string path);
830};
837
847 const S_IFMT = S_IFMT;
885}
Interface for builtin classes that support I/O polling.
Definition: QC_AbstractPollableIoObjectBase.dox.h:8
The ReadOnlyFile class allows Qore programs to read existing files.
Definition: QC_ReadOnlyFile.dox.h:23
bool isDataAvailable(timeout timeout_ms=0)
Returns True if there is data available for reading from the file within the timeout period.
static binary readBinaryFile(string path, int max_file_len=-1)
returns the contents of a binary file as a binary object
*int readi8()
Reads an 8-byte (64 bit) signed integer from the file in binary big-endian format or NOTHING if no da...
*int readu2()
Reads a 2-byte (16 bit) unsigned integer from the ReadOnlyFile in binary big-endian format or NOTHING...
*int readu4LSB()
Reads a 4-byte (32 bit) unsigned integer from the file in binary little-endian format or NOTHING if n...
bool isOpen()
returns True if the File is open, False if not
static hash< StatInfo > hstat(string path)
Returns a StatInfo hash about the file's status (follows symbolic links) or throws an exception if an...
*string readLine(bool incl_eol=True, *string eol)
Reads until an EOL marker is found and returns the string read or NOTHING if no data can be read.
int setPos(int pos=0)
Sets the current file position (in bytes from the beginning of the file)
*int readu2LSB()
Reads a 2-byte (16 bit) unsigned integer from the file in binary little-endian format or NOTHING if n...
static string readTextFile(string path, *string encoding, int max_file_len=-1)
returns the contents of a text file as a string optionally tagged with the given character encoding
nothing setEventQueue()
Removes any Queue object from the ReadOnlyFile object so that file events are no longer added to the ...
nothing open(string path, *string encoding)
Opens a file in a particular mode; throws an exception on failure.
constructor(string path, *string encoding)
Creates the ReadOnlyFile object.
*int readi4LSB()
Reads a 4-byte (32 bit) signed integer from the file in binary little-endian format or NOTHING if no ...
hash< StatInfo > hstat()
Returns a StatInfo hash about the file's status or throws an exception if any errors occur.
*int readi2()
Reads a 2-byte (16 bit) signed integer from the file in binary big-endian format or NOTHING if no dat...
hash< FilesystemInfo > statvfs()
Returns a FilesystemInfo hash about the file's filesystem status or throws an exception if any errors...
string getEncoding()
Returns the character encoding for the ReadOnlyFile.
static list< auto > stat(string path)
Returns a Stat List about the file's status (follows symbolic links) or throws an exception if any er...
nothing setEventQueue(Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive file events.
int getPos()
Returns the current file position as an integer giving the offset in bytes from the beginning of the ...
*string getFileName()
returns the file path/name used to open the file if the file is open, otherwise NOTHING
copy()
Creates a new ReadOnlyFile object with the same character encoding specification as the original,...
*int readi4()
Reads a 4-byte (32 bit) signed integer from the file in binary big-endian format or NOTHING if no dat...
int close()
Closes the ReadOnlyFile object.
destructor()
Closes the ReadOnlyFile if it is open and destroys the ReadOnlyFile object.
*string getchar()
Reads one character from the file and returns it as a string; returns NOTHING if no data can be read ...
*string read(softint size, timeout timeout_ms=-1)
Reads a certain number of characters from the ReadOnlyFile within an optional timeout period and retu...
nothing setEncoding(*string encoding)
Sets the character encoding for the ReadOnlyFile; if called with no argument, the default encoding is...
*binary readBinary(softint size, timeout timeout_ms=-1)
Reads a certain number of bytes from the file within an optional timeout period and returns a binary ...
static hash< StatInfo > hlstat(string path)
Returns a StatInfo hash about the file's status (does not follow symbolic links) or throws an excepti...
*int readi2LSB()
Reads a 2-byte (16 bit) signed integer from the file in binary little-endian format or NOTHING if no ...
*int readu4()
Reads a 4-byte (32 bit) unsigned integer from the file in big-endian format or NOTHING if no data can...
*int readu1()
Reads a 1-byte unsigned integer from the ReadOnlyFile in binary format or NOTHING if no data can be r...
*int readi8LSB()
Reads an 8-byte (64 bit) signed integer from the file in binary little-endian format or NOTHING if no...
list< auto > stat()
Returns a Stat List about the file's status or throws an exception if any errors occur.
static list< auto > lstat(string path)
Returns a Stat List about the given path's status (does not follow symbolic links) or throws an excep...
static hash< FilesystemInfo > statvfs(string path)
Returns a FilesystemInfo hash about filesystem status of the given path; throws an exception if any e...
*int readi1()
Reads a 1-byte signed integer from the file in binary format or NOTHING if no data can be read.
bool isTty()
returns True if the File is connected to a terminal device, False if not
const True
logical True
Definition: qc_qore.dox.h:98
const S_IWUSR
Bit signifying if the file's owner has write permissions.
Definition: QC_ReadOnlyFile.dox.h:877
const S_IFMT
File type bitmask
Definition: QC_ReadOnlyFile.dox.h:847
const S_IFWHT
Bitmask signifying if the file is a whiteout file; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:853
const S_IFSOCK
Bitmask signifying if the file is a socket file; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:851
const S_IFLNK
Bitmask signifying if the file is a symbolic link; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:845
const S_IFBLK
Bitmask signifying if the file is a block special (device) file.
Definition: QC_ReadOnlyFile.dox.h:839
const S_ISVTX
Bit signifying restricted deletes for directories; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:871
const S_IRGRP
Bit signifying if the file's group has read permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:855
const S_ISUID
Bit signifying set user id on execution; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:869
const S_ISGID
Bit signifying set group id on execution; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:867
const S_IXUSR
Bit signifying if the file's owner has execute permissions.
Definition: QC_ReadOnlyFile.dox.h:883
const S_IWGRP
Bit signifying if the file's group has write permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:873
const S_IRWXG
Bitmask giving the RWX mask for the group; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:861
const S_IRUSR
Bit signifying if the file's owner has read permissions.
Definition: QC_ReadOnlyFile.dox.h:859
const S_IFREG
Bit signifying if the file is a regular file.
Definition: QC_ReadOnlyFile.dox.h:849
const S_IRWXO
Bitmask giving the RWX mask for other; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:863
const S_IFDIR
Bit signifying if the entry is a directory.
Definition: QC_ReadOnlyFile.dox.h:843
const S_IWOTH
Bit signifying if other has write permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:875
const S_IXOTH
Bit signifying if other has execute permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:881
const S_IXGRP
Bit signifying if the file's group has execute permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:879
const S_IRWXU
Bitmask giving the RWX mask for the owner.
Definition: QC_ReadOnlyFile.dox.h:865
const S_IROTH
Bit signifying if other has read permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:857
const S_IFCHR
Bit signifying if the file is a character special (device) file.
Definition: QC_ReadOnlyFile.dox.h:841
binary binary()
Always returns an empty binary object (of zero length)
Qore namespace.
Definition: QC_AbstractSmartLock.dox.h:2