$darkmode
Qore Programming Language Reference Manual 1.19.2
QC_ReadOnlyFile.dox.h
1 
3 namespace Qore {
5 
24 
25 public:
27 
41 int close();
42 
43 public:
45 
68  constructor(string path, *string encoding);
69 
70 public:
72 
77  copy();
78 
79 public:
81 
84 
85 public:
87 
97 string getEncoding();
98 
99 public:
101 
113 *string getFileName();
114 
115 public:
117 
131 int getPos();
132 
133 public:
135 
148 *string getchar();
149 
150 public:
152 
168 hash<StatInfo> hstat();
169 
170 public:
172 
189 bool isDataAvailable(timeout timeout_ms = 0);
190 
191 public:
193 
203 bool isOpen();
204 
205 public:
207 
219 bool isTty();
220 
221 public:
223 
255 nothing open(string path, *string encoding);
256 
257 public:
259 
300 *string read(softint size, timeout timeout_ms = -1);
301 
302 public:
304 
331 *binary readBinary(softint size, timeout timeout_ms = -1);
332 
333 public:
335 
360 *string readLine(bool incl_eol = True, *string eol);
361 
362 public:
364 
377 *int readi1();
378 
379 public:
381 
394 *int readi2();
395 
396 public:
398 
411 *int readi2LSB();
412 
413 public:
415 
428 *int readi4();
429 
430 public:
432 
445 *int readi4LSB();
446 
447 public:
449 
462 *int readi8();
463 
464 public:
466 
479 *int readi8LSB();
480 
481 public:
483 
498 *int readu1();
499 
500 public:
502 
517 *int readu2();
518 
519 public:
521 
534 *int readu2LSB();
535 
536 public:
538 
553 *int readu4();
554 
555 public:
557 
570 *int readu4LSB();
571 
572 public:
574 
585 nothing setEncoding(*string encoding);
586 
587 public:
589 
605 nothing setEventQueue(Queue queue, auto arg, *bool with_data);
606 
607 public:
609 
618 nothing setEventQueue();
619 
620 public:
622 
635 int setPos(int pos = 0);
636 
637 public:
639 
657 AbstractPollOperation startPollRead(string path, bool to_string = True, int to_read = -1);
658 
659 public:
661 
677 list<auto> stat();
678 
679 public:
681 
697 hash<FilesystemInfo> statvfs();
698 
699 public:
701 
723 static hash<StatInfo> hlstat(string path);
724 
725 public:
727 
748 static hash<StatInfo> hstat(string path);
749 
750 public:
752 
774 static list<auto> lstat(string path);
775 
776 public:
778 
800 static binary readBinaryFile(string path, int max_file_len = -1);
801 
802 public:
804 
829 static string readTextFile(string path, *string encoding, int max_file_len = -1);
830 
831 public:
833 
854 static list<auto> stat(string path);
855 
856 public:
858 
880 static hash<FilesystemInfo> statvfs(string path);
881 };
888 
890  const S_IFBLK = S_IFBLK;
892  const S_IFCHR = S_IFCHR;
894  const S_IFDIR = S_IFDIR;
896  const S_IFLNK = S_IFLNK;
898  const S_IFMT = S_IFMT;
900  const S_IFREG = S_IFREG;
904  const S_IFWHT = S_IFWHT;
906  const S_IRGRP = S_IRGRP;
908  const S_IROTH = S_IROTH;
910  const S_IRUSR = S_IRUSR;
912  const S_IRWXG = S_IRWXG;
914  const S_IRWXO = S_IRWXO;
916  const S_IRWXU = S_IRWXU;
918  const S_ISGID = S_ISGID;
920  const S_ISUID = S_ISUID;
922  const S_ISVTX = S_ISVTX;
924  const S_IWGRP = S_IWGRP;
926  const S_IWOTH = S_IWOTH;
928  const S_IWUSR = S_IWUSR;
930  const S_IXGRP = S_IXGRP;
932  const S_IXOTH = S_IXOTH;
934  const S_IXUSR = S_IXUSR;
936 }
Abstract poll operation objects provide the polling interface for pollable objects.
Definition: QC_AbstractPollOperation.dox.h:6
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.
list< auto > stat()
Returns a Stat List about the file's status or throws an exception if any errors occur.
static hash< StatInfo > hstat(string path)
Returns a StatInfo hash about the file's status (follows symbolic links) or throws an exception if an...
static binary readBinaryFile(string path, int max_file_len=-1)
returns the contents of a binary file as a binary object
hash< StatInfo > hstat()
Returns a StatInfo hash about the file's status or throws an exception if any errors occur.
*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
*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 ...
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...
*int readi2()
Reads a 2-byte (16 bit) signed integer from the file in binary big-endian format or NOTHING if no dat...
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...
string getEncoding()
Returns the character encoding for the ReadOnlyFile.
nothing setEventQueue(Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive file events.
AbstractPollOperation startPollRead(string path, bool to_string=True, int to_read=-1)
Returns an AbstractPollOperation object to read a file from the filesystem.
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,...
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 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 ...
*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...
static hash< FilesystemInfo > statvfs(string path)
Returns a FilesystemInfo hash about filesystem status of the given path; throws an exception if any e...
*int readu1()
Reads a 1-byte unsigned integer from the ReadOnlyFile in binary format or NOTHING if no data can be r...
hash< FilesystemInfo > statvfs()
Returns a FilesystemInfo hash about the file's filesystem status or throws an exception if any errors...
*int readi8LSB()
Reads an 8-byte (64 bit) signed integer from the file in binary little-endian format or NOTHING if no...
*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:928
const S_IFMT
File type bitmask
Definition: QC_ReadOnlyFile.dox.h:898
const S_IFWHT
Bitmask signifying if the file is a whiteout file; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:904
const S_IFSOCK
Bitmask signifying if the file is a socket file; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:902
const S_IFLNK
Bitmask signifying if the file is a symbolic link; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:896
const S_IFBLK
Bitmask signifying if the file is a block special (device) file.
Definition: QC_ReadOnlyFile.dox.h:890
const S_ISVTX
Bit signifying restricted deletes for directories; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:922
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:906
const S_ISUID
Bit signifying set user id on execution; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:920
const S_ISGID
Bit signifying set group id on execution; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:918
const S_IXUSR
Bit signifying if the file's owner has execute permissions.
Definition: QC_ReadOnlyFile.dox.h:934
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:924
const S_IRWXG
Bitmask giving the RWX mask for the group; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:912
const S_IRUSR
Bit signifying if the file's owner has read permissions.
Definition: QC_ReadOnlyFile.dox.h:910
const S_IFREG
Bit signifying if the file is a regular file.
Definition: QC_ReadOnlyFile.dox.h:900
const S_IRWXO
Bitmask giving the RWX mask for other; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:914
const S_IFDIR
Bit signifying if the entry is a directory.
Definition: QC_ReadOnlyFile.dox.h:894
const S_IWOTH
Bit signifying if other has write permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:926
const S_IXOTH
Bit signifying if other has execute permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:932
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:930
const S_IRWXU
Bitmask giving the RWX mask for the owner.
Definition: QC_ReadOnlyFile.dox.h:916
const S_IROTH
Bit signifying if other has read permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:908
const S_IFCHR
Bit signifying if the file is a character special (device) file.
Definition: QC_ReadOnlyFile.dox.h:892
binary binary()
Always returns an empty binary object (of zero length)
Qore namespace.
Definition: QC_AbstractBidirectionalIterator.dox.h:2