Qore Programming Language Reference Manual  0.9.3.1
QC_ReadOnlyFile.dox.h
1 namespace Qore {
4 
18 class ReadOnlyFile {
19 
20 public:
22 
35 int close();
36 
37 public:
39 
56  constructor(string path, *string encoding);
57 
58 public:
60 
65  copy();
66 
67 public:
69 
71  destructor();
72 
73 public:
75 
85 string getEncoding();
86 
87 public:
89 
101 *string getFileName();
102 
103 public:
105 
119 int getPos();
120 
121 public:
123 
136 *string getchar();
137 
138 public:
140 
156 hash<StatInfo> hstat();
157 
158 public:
160 
177 bool isDataAvailable(timeout timeout_ms = 0);
178 
179 public:
181 
191 bool isOpen();
192 
193 public:
195 
207 bool isTty();
208 
209 public:
211 
236 nothing open(string path, *string encoding);
237 
238 public:
240 
268 *string read(softint size, timeout timeout_ms = -1);
269 
270 public:
272 
299 *binary readBinary(softint size, timeout timeout_ms = -1);
300 
301 public:
303 
328 *string readLine(bool incl_eol = True, *string eol);
329 
330 public:
332 
345 *int readi1();
346 
347 public:
349 
362 *int readi2();
363 
364 public:
366 
379 *int readi2LSB();
380 
381 public:
383 
396 *int readi4();
397 
398 public:
400 
413 *int readi4LSB();
414 
415 public:
417 
430 *int readi8();
431 
432 public:
434 
447 *int readi8LSB();
448 
449 public:
451 
464 *int readu1();
465 
466 public:
468 
481 *int readu2();
482 
483 public:
485 
498 *int readu2LSB();
499 
500 public:
502 
515 *int readu4();
516 
517 public:
519 
532 *int readu4LSB();
533 
534 public:
536 
545 nothing setEncoding(*string encoding);
546 
547 public:
549 
561 nothing setEventQueue(Qore::Thread::Queue queue);
562 
563 public:
565 
574 nothing setEventQueue();
575 
576 public:
578 
591 int setPos(int pos = 0);
592 
593 public:
595 
611 list<auto> stat();
612 
613 public:
615 
631 hash<FilesystemInfo> statvfs();
632 
633 public:
635 
657 static hash<StatInfo> hlstat(string path);
658 
659 public:
661 
682 static hash<StatInfo> hstat(string path);
683 
684 public:
686 
708 static list<auto> lstat(string path);
709 
710 public:
712 
734 static binary readBinaryFile(string path, int max_file_len = -1);
735 
736 public:
738 
763 static string readTextFile(string path, *string encoding, int max_file_len = -1);
764 
765 public:
767 
788 static list<auto> stat(string path);
789 
790 public:
792 
814 static hash<FilesystemInfo> statvfs(string path);
815 };
820 
822  const S_IFBLK = S_IFBLK;
824  const S_IFCHR = S_IFCHR;
826  const S_IFDIR = S_IFDIR;
828  const S_IFLNK = S_IFLNK;
830  const S_IFMT = S_IFMT;
832  const S_IFREG = S_IFREG;
836  const S_IFWHT = S_IFWHT;
838  const S_IRGRP = S_IRGRP;
840  const S_IROTH = S_IROTH;
842  const S_IRUSR = S_IRUSR;
844  const S_IRWXG = S_IRWXG;
846  const S_IRWXO = S_IRWXO;
848  const S_IRWXU = S_IRWXU;
850  const S_ISGID = S_ISGID;
852  const S_ISUID = S_ISUID;
854  const S_ISVTX = S_ISVTX;
856  const S_IWGRP = S_IWGRP;
858  const S_IWOTH = S_IWOTH;
860  const S_IWUSR = S_IWUSR;
862  const S_IXGRP = S_IXGRP;
864  const S_IXOTH = S_IXOTH;
866  const S_IXUSR = S_IXUSR;
868 };
constructor(string path, *string encoding)
Creates the ReadOnlyFile object.
*int readu4()
Reads a 4-byte (32 bit) unsigned integer from the file in big-endian format or NOTHING if no data can...
const S_IFREG
Bit signifying if the file is a regular file.
Definition: QC_ReadOnlyFile.dox.h:832
*int readi4()
Reads a 4-byte (32 bit) signed integer from the file in binary big-endian format or NOTHING if no dat...
const S_IRWXO
Bitmask giving the RWX mask for other; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:846
const S_IFDIR
Bit signifying if the entry is a directory.
Definition: QC_ReadOnlyFile.dox.h:826
const S_IRWXU
Bitmask giving the RWX mask for the owner.
Definition: QC_ReadOnlyFile.dox.h:848
static hash< StatInfo > hlstat(string path)
Returns a StatInfo hash about the file's status (does not follow symbolic links) or throws an excepti...
static binary readBinaryFile(string path, int max_file_len=-1)
returns the contents of a binary file as a binary object
*int readu2LSB()
Reads a 2-byte (16 bit) unsigned integer from the file in binary little-endian format or NOTHING if n...
int setPos(int pos=0)
Sets the current file position (in bytes from the beginning of the file)
const S_IFWHT
Bitmask signifying if the file is a whiteout file; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:836
const True
logical True
Definition: qc_qore.dox.h:94
copy()
Creates a new ReadOnlyFile object with the same character encoding specification as the original,...
nothing open(string path, *string encoding)
Opens a file in a particular mode; throws an exception on failure.
string getEncoding()
Returns the character encoding for the ReadOnlyFile.
const S_IXUSR
Bit signifying if the file's owner has execute permissions.
Definition: QC_ReadOnlyFile.dox.h:866
binary binary()
Always returns an empty binary object (of zero length)
bool isOpen()
returns True if the File is open, False if not
const S_IWUSR
Bit signifying if the file's owner has write permissions.
Definition: QC_ReadOnlyFile.dox.h:860
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...
*string read(softint size, timeout timeout_ms=-1)
Reads a certain number of characters from the ReadOnlyFile within an optional timeout period and retu...
*string getFileName()
returns the file path/name used to open the file if the file is open, otherwise NOTHING
int close()
Closes 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 ...
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:838
*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 getPos()
Returns the current file position as an integer giving the offset in bytes from the beginning of the ...
destructor()
Closes the ReadOnlyFile if it is open and destroys the ReadOnlyFile object.
*int readi1()
Reads a 1-byte signed integer from the file in binary format or NOTHING if no data can be read.
hash< FilesystemInfo > statvfs()
Returns a FilesystemInfo hash about the file's filesystem status or throws an exception if any errors...
const S_IFCHR
Bit signifying if the file is a character special (device) file.
Definition: QC_ReadOnlyFile.dox.h:824
*int readi2LSB()
Reads a 2-byte (16 bit) signed integer from the file in binary little-endian format or NOTHING if no ...
*int readi8()
Reads an 8-byte (64 bit) signed integer from the file in binary big-endian format or NOTHING if no da...
list< auto > stat()
Returns a Stat List about the file's status or throws an exception if any errors occur.
const S_IROTH
Bit signifying if other has read permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:840
*int readi4LSB()
Reads a 4-byte (32 bit) signed integer from the file in binary little-endian format or NOTHING if no ...
bool isDataAvailable(timeout timeout_ms=0)
Returns True if there is data available for reading from the file within the timeout period.
hash< StatInfo > hstat()
Returns a StatInfo hash about the file's status or throws an exception if any errors occur.
const S_IWOTH
Bit signifying if other has write permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:858
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:862
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
const S_ISUID
Bit signifying set user id on execution; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:852
const S_IFLNK
Bitmask signifying if the file is a symbolic link; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:828
const S_ISVTX
Bit signifying restricted deletes for directories; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:854
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:856
const S_IFMT
File type bitmask
Definition: QC_ReadOnlyFile.dox.h:830
*int readu4LSB()
Reads a 4-byte (32 bit) unsigned integer from the file in binary little-endian format or NOTHING if n...
Queue objects provide a blocking, thread-safe message-passing object to Qore programs
Definition: QC_Queue.dox.h:15
*int readi2()
Reads a 2-byte (16 bit) signed integer from the file in binary big-endian format or NOTHING if no dat...
const S_IFBLK
Bitmask signifying if the file is a block special (device) file.
Definition: QC_ReadOnlyFile.dox.h:822
nothing setEventQueue()
Removes any Queue object from the ReadOnlyFile object so that file events are no longer added to the ...
nothing setEncoding(*string encoding)
Sets the character encoding for the ReadOnlyFile; if called with no argument, the default encoding is...
const S_ISGID
Bit signifying set group id on execution; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:850
bool isTty()
returns True if the File is connected to a terminal device, False if not
*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 ...
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:2
const S_IRWXG
Bitmask giving the RWX mask for the group; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:844
const S_IFSOCK
Bitmask signifying if the file is a socket file; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:834
The ReadOnlyFile class allows Qore programs to read existing files.
Definition: QC_ReadOnlyFile.dox.h:18
*int readu1()
Reads a 1-byte unsigned integer from the ReadOnlyFile in binary format or NOTHING if no data can be r...
*int readu2()
Reads a 2-byte (16 bit) unsigned integer from the ReadOnlyFile in binary big-endian format or NOTHING...
const S_IRUSR
Bit signifying if the file's owner has read permissions.
Definition: QC_ReadOnlyFile.dox.h:842
const S_IXOTH
Bit signifying if other has execute permissions; equal to 0 on native Windows ports.
Definition: QC_ReadOnlyFile.dox.h:864
*int readi8LSB()
Reads an 8-byte (64 bit) signed integer from the file in binary little-endian format or NOTHING if no...