\hypertarget{class_qore_1_1_read_only_file}{}\doxysection{Qore\+::Read\+Only\+File Class Reference}
\label{class_qore_1_1_read_only_file}\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}


The Read\+Only\+File class allows Qore programs to read existing files.  




{\ttfamily \#include $<$QC\+\_\+\+Read\+Only\+File.\+dox.\+h$>$}



Inheritance diagram for Qore\+::Read\+Only\+File\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=214pt]{class_qore_1_1_read_only_file__inherit__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_ab0a881df9958ae97f26a8764cbd1db5e}{close}} ()
\begin{DoxyCompactList}\small\item\em Closes the Read\+Only\+File object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_read_only_file_a4ff458d87e7340ad37a2e4cc43df0df0}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Creates the Read\+Only\+File object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_read_only_file_a9bea75648d7897782fb6efa45f7463da}{copy}} ()
\begin{DoxyCompactList}\small\item\em Creates a new Read\+Only\+File object with the same \mbox{\hyperlink{character_encoding}{character encoding}} specification as the original, otherwise no other information is copied. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_read_only_file_ab5c2cb791f0aedf3bf7de0c3b8a30b95}{destructor}} ()
\begin{DoxyCompactList}\small\item\em Closes the Read\+Only\+File if it is open and destroys the Read\+Only\+File object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a75abf43a49da44da7095c8f467834ffe}{get\+Encoding}} ()
\begin{DoxyCompactList}\small\item\em Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the Read\+Only\+File. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a9b323248355ff9dc2048ea913664e111}{get\+File\+Name}} ()
\begin{DoxyCompactList}\small\item\em returns the file path/name used to open the file if the file is open, otherwise \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a995bc1347bebfff19439425a569d96d6}{get\+Pos}} ()
\begin{DoxyCompactList}\small\item\em Returns the current file position as an integer giving the offset in bytes from the beginning of the file (starting from zero) \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_read_only_file_ab6946821b81fc2b9b4f07ef27ebacd45}{getchar}} ()
\begin{DoxyCompactList}\small\item\em Reads one character from the file and returns it as a string; returns \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read from the file. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_a649f32981a2419c6d0e335ee4b310bf1}{hstat}} ()
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status or throws an exception if any errors occur. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_read_only_file_a0bae6c89d6262b18785b0727866a3405}{is\+Data\+Available}} (timeout timeout\+\_\+ms=0)
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} if there is data available for reading from the file within the timeout period. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_read_only_file_a2744f4642700d0f273efbce43f709fb4}{is\+Open}} ()
\begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file}{File}} is open, \mbox{\hyperlink{basic_data_types_False}{False}} if not \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_read_only_file_afd64015ff14cb58d2f2c365d36a9c85c}{is\+Tty}} ()
\begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file}{File}} is connected to a terminal device, \mbox{\hyperlink{basic_data_types_False}{False}} if not \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_read_only_file_a487b2f0b5b97ac8958eff649867f97ff}{open}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Opens a file in a particular mode; throws an exception on failure. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_read_only_file_ac4475042a820d3d303b1b67f3921e728}{read}} (softint size, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads a certain number of characters from the Read\+Only\+File within an optional timeout period and returns a string of the data read or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{class_qore_1_1_read_only_file_ac9513b569846b16e2b7363df5ba9f647}{read\+Binary}} (softint size, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads a certain number of bytes from the file within an optional timeout period and returns a binary object of the data read or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a3407127e38d2a2ffe3c473d02561f788}{read\+Line}} (bool incl\+\_\+eol=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} eol)
\begin{DoxyCompactList}\small\item\em Reads until an EOL marker is found and returns the string read or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_afd50d3b67d82c8945bdb5a4684b1be21}{readi1}} ()
\begin{DoxyCompactList}\small\item\em Reads a 1-\/byte signed integer from the file in binary format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a64ffeeac6c8365c6c5ab079930b07d44}{readi2}} ()
\begin{DoxyCompactList}\small\item\em Reads a 2-\/byte (16 bit) signed integer from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_acfa7b5d8ddbb414aea45cd44e18c7b31}{readi2\+LSB}} ()
\begin{DoxyCompactList}\small\item\em Reads a 2-\/byte (16 bit) signed integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_aaea5bb2ae5ab21d294cbba5bce380cdf}{readi4}} ()
\begin{DoxyCompactList}\small\item\em Reads a 4-\/byte (32 bit) signed integer from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a5b0f2624f94f841f38c03acb0c9f6d0a}{readi4\+LSB}} ()
\begin{DoxyCompactList}\small\item\em Reads a 4-\/byte (32 bit) signed integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a1e2026f6813d966c9f016a36cf500e83}{readi8}} ()
\begin{DoxyCompactList}\small\item\em Reads an 8-\/byte (64 bit) signed integer from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_ae2b4ee10d080318b034b03db976220a5}{readi8\+LSB}} ()
\begin{DoxyCompactList}\small\item\em Reads an 8-\/byte (64 bit) signed integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_adb1fb818dd189e65d5fb9eae59d497b2}{readu1}} ()
\begin{DoxyCompactList}\small\item\em Reads a 1-\/byte unsigned integer from the Read\+Only\+File in binary format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a24582228c99f247ffbab087b35e5d8bc}{readu2}} ()
\begin{DoxyCompactList}\small\item\em Reads a 2-\/byte (16 bit) unsigned integer from the Read\+Only\+File in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a385bd014878acbe7694439dff8b23d6c}{readu2\+LSB}} ()
\begin{DoxyCompactList}\small\item\em Reads a 2-\/byte (16 bit) unsigned integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_ad32a00cfec6f1c402b1190841cb95796}{readu4}} ()
\begin{DoxyCompactList}\small\item\em Reads a 4-\/byte (32 bit) unsigned integer from the file in big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a249229b21e021e85c8a854a91a728c68}{readu4\+LSB}} ()
\begin{DoxyCompactList}\small\item\em Reads a 4-\/byte (32 bit) unsigned integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_read_only_file_ac5ed072e0e98c0b8f497724423be5ecd}{set\+Encoding}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Sets the \mbox{\hyperlink{character_encoding}{character encoding}} for the Read\+Only\+File; if called with no argument, the \mbox{\hyperlink{character_encoding_default_encoding}{default encoding}} is set. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_read_only_file_a7e7420155a764474130f364693d90954}{set\+Event\+Queue}} (Queue queue, auto arg, \+\_\+\+\_\+7\+\_\+ bool with\+\_\+data)
\begin{DoxyCompactList}\small\item\em Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive \mbox{\hyperlink{class_qore_1_1_file_file_events}{file events}}. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_read_only_file_a44207327eadce535f46cbfcba1bff28a}{set\+Event\+Queue}} ()
\begin{DoxyCompactList}\small\item\em Removes any \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object from the Read\+Only\+File object so that \mbox{\hyperlink{class_qore_1_1_file_file_events}{file events}} are no longer added to the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a34b10ef0bdee5bda118d3923367aea4d}{set\+Pos}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} pos=0)
\begin{DoxyCompactList}\small\item\em Sets the current file position (in bytes from the beginning of the file) \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat}} ()
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} about the file\textquotesingle{}s status or throws an exception if any errors occur. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_a6681ce768d279f359a4d74ab58e40a16}{statvfs}} ()
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash about the file\textquotesingle{}s filesystem status or throws an exception if any errors occur. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_acc4469d7f06423f58d9bf4bee20765b4}{hlstat}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status (does not follow symbolic links) or throws an exception if any errors occur. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_a2b383f3c0d576ca17ec907f2e6cda43d}{hstat}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status (follows symbolic links) or throws an exception if any errors occur. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_aebe2680d90eac6f78773106cac9e3aff}{lstat}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} about the given path\textquotesingle{}s status (does not follow symbolic links) or throws an exception if any errors occur. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a149f83530ad4d521af205a711253662c}{read\+Binary\+File}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} max\+\_\+file\+\_\+len=-\/1)
\begin{DoxyCompactList}\small\item\em returns the contents of a binary file as a binary object \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_read_only_file_a41a3763d813c0b7d41eec553819e1354}{read\+Text\+File}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} max\+\_\+file\+\_\+len=-\/1)
\begin{DoxyCompactList}\small\item\em returns the contents of a text file as a string optionally tagged with the given \mbox{\hyperlink{character_encoding}{character encoding}} \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_a770673d2a8a03471ae184e45d41b8264}{stat}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} about the file\textquotesingle{}s status (follows symbolic links) or throws an exception if any errors occur. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_read_only_file_aebe7a731a705ffc50c869873d13fc650}{statvfs}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash about filesystem status of the given path; throws an exception if any errors occur. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
The Read\+Only\+File class allows Qore programs to read existing files. 

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyNote}{Note}
This class is not available with the \mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{PO\+\_\+\+NO\+\_\+\+FILESYSTEM}} parse option
\end{DoxyNote}
Read\+Only\+File objects are opened with a specific \mbox{\hyperlink{character_encoding}{character encoding}}, meaning that any string read from the file will be tagged with the file\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}}. If no \mbox{\hyperlink{character_encoding}{character encoding}} is specified, then the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} is assumed for the file.

This class supports posting read events to a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}}. See \mbox{\hyperlink{event_handling}{I/O Event Handling}} for more information.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_file_file_events}{file\+\_\+events}} for a \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}} of I/O events raised by this object
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this class was split from the \mbox{\hyperlink{class_qore_1_1_file}{Qore\+::\+File}} class and added as a base class of \mbox{\hyperlink{class_qore_1_1_file}{Qore\+::\+File}} 
\end{DoxySince}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_ab0a881df9958ae97f26a8764cbd1db5e}\label{class_qore_1_1_read_only_file_ab0a881df9958ae97f26a8764cbd1db5e}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!close@{close}}
\index{close@{close}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{close()}{close()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::close (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Closes the Read\+Only\+File object. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (f.close())}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}error closing file: \%s\(\backslash\)n"{}}, strerror(errno()));}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CHANNEL_CLOSED}{EVENT\+\_\+\+CHANNEL\+\_\+\+CLOSED}}
\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxyReturn}{Returns}
0 for success, -\/1 for an error (see \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} and \mbox{\hyperlink{group__library__functions_gadfdbab96958d3623d431a7ab292d7e27}{strerror()}} for the error information) 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a4ff458d87e7340ad37a2e4cc43df0df0}\label{class_qore_1_1_read_only_file_a4ff458d87e7340ad37a2e4cc43df0df0}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+Read\+Only\+File\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Creates the Read\+Only\+File object. 

The constructor takes the file path and one optional argument that will set the default \mbox{\hyperlink{character_encoding}{character encoding}} for the file (only affects reading string data) To open the file again with another file, call \mbox{\hyperlink{class_qore_1_1_read_only_file_a487b2f0b5b97ac8958eff649867f97ff}{Read\+Only\+File\+::open()}}; the \mbox{\hyperlink{character_encoding}{character encoding}} can also be set or changed by the \mbox{\hyperlink{class_qore_1_1_read_only_file_a487b2f0b5b97ac8958eff649867f97ff}{Read\+Only\+File\+::open()}} or \mbox{\hyperlink{class_qore_1_1_read_only_file_ac5ed072e0e98c0b8f497724423be5ecd}{Read\+Only\+File\+::set\+Encoding()}} methods.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ReadOnlyFile f(\textcolor{stringliteral}{"{}/tmp/my-\/file.txt"{}}, \textcolor{stringliteral}{"{}iso-\/8859-\/1"{}});}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the path to open for reading \\
\hline
{\em encoding} & The \mbox{\hyperlink{character_encoding}{character encoding}} for the Read\+Only\+File. Strings data read from the file will be tagged with this \mbox{\hyperlink{character_encoding}{character encoding}}; if this argument is not given then the Read\+Only\+File will receive the \mbox{\hyperlink{character_encoding_default_encoding}{default encoding}}\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em READONLYFILE-\/\+OPEN-\/\+ERROR} & the given file cannot be opened for reading ({\ttfamily arg} will be assigned to the errno value) \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & \mbox{\hyperlink{class_qore_1_1_abstract_pollable_io_object_base_a772a2dc97dddb19a647ccdc863068d57}{Read\+Only\+File\+::constructor()}} cannot be called with a TTY target when \mbox{\hyperlink{parse_directives_no-terminal-io}{\%no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_read_only_file_a487b2f0b5b97ac8958eff649867f97ff}{Read\+Only\+File\+::open()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a9bea75648d7897782fb6efa45f7463da}\label{class_qore_1_1_read_only_file_a9bea75648d7897782fb6efa45f7463da}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!copy@{copy}}
\index{copy@{copy}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+Read\+Only\+File\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Creates a new Read\+Only\+File object with the same \mbox{\hyperlink{character_encoding}{character encoding}} specification as the original, otherwise no other information is copied. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ReadOnlyFile f1 = f.copy();}

\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_ab5c2cb791f0aedf3bf7de0c3b8a30b95}\label{class_qore_1_1_read_only_file_ab5c2cb791f0aedf3bf7de0c3b8a30b95}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!destructor@{destructor}}
\index{destructor@{destructor}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{destructor()}{destructor()}}
{\footnotesize\ttfamily Qore\+::\+Read\+Only\+File\+::destructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Closes the Read\+Only\+File if it is open and destroys the Read\+Only\+File object. 

Closes the Read\+Only\+File if it is open and destroys the Read\+Only\+File object \mbox{\Hypertarget{class_qore_1_1_read_only_file_ab6946821b81fc2b9b4f07ef27ebacd45}\label{class_qore_1_1_read_only_file_ab6946821b81fc2b9b4f07ef27ebacd45}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!getchar@{getchar}}
\index{getchar@{getchar}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{getchar()}{getchar()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Read\+Only\+File\+::getchar (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads one character from the file and returns it as a string; returns \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read from the file. 

Multi-\/byte characters are also read; use \mbox{\hyperlink{class_qore_1_1_read_only_file_adb1fb818dd189e65d5fb9eae59d497b2}{Read\+Only\+File\+::readu1()}} or \mbox{\hyperlink{class_qore_1_1_read_only_file_afd50d3b67d82c8945bdb5a4684b1be21}{Read\+Only\+File\+::readi1()}} to read a single byte from a file regardless of the Read\+Only\+File\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}}.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*string str = f.getchar();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the single character read from the file or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read from the Read\+Only\+File
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em FILE-\/\+GETCHAR-\/\+ERROR} & invalid multi-\/byte character read or EOF received while reading a multi-\/byte character \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a75abf43a49da44da7095c8f467834ffe}\label{class_qore_1_1_read_only_file_a75abf43a49da44da7095c8f467834ffe}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!getEncoding@{getEncoding}}
\index{getEncoding@{getEncoding}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{getEncoding()}{getEncoding()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Read\+Only\+File\+::get\+Encoding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the Read\+Only\+File. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string encoding = f.getEncoding();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the \mbox{\hyperlink{character_encoding}{character encoding}} for the Read\+Only\+File 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a9b323248355ff9dc2048ea913664e111}\label{class_qore_1_1_read_only_file_a9b323248355ff9dc2048ea913664e111}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!getFileName@{getFileName}}
\index{getFileName@{getFileName}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{getFileName()}{getFileName()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Read\+Only\+File\+::get\+File\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the file path/name used to open the file if the file is open, otherwise \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*string fn = f.getFileName();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the file path/name used to open the file if the file is open, otherwise \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}}
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a995bc1347bebfff19439425a569d96d6}\label{class_qore_1_1_read_only_file_a995bc1347bebfff19439425a569d96d6}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!getPos@{getPos}}
\index{getPos@{getPos}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{getPos()}{getPos()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::get\+Pos (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the current file position as an integer giving the offset in bytes from the beginning of the file (starting from zero) 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int pos = f.getPos();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the current file position as an integer giving the offset in bytes from the beginning of the file (starting from zero)
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_read_only_file_a34b10ef0bdee5bda118d3923367aea4d}{Read\+Only\+File\+::set\+Pos()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_acc4469d7f06423f58d9bf4bee20765b4}\label{class_qore_1_1_read_only_file_acc4469d7f06423f58d9bf4bee20765b4}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!hlstat@{hlstat}}
\index{hlstat@{hlstat}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{hlstat()}{hlstat()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ Qore\+::\+Read\+Only\+File\+::hlstat (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status (does not follow symbolic links) or throws an exception if any errors occur. 

Does not follow symbolic links, but rather returns filesystem information for symbolic links. If any errors occur, a {\ttfamily FILE-\/\+HSTAT-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<StatInfo> h = ReadOnlyFile::hstat(path);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the file to \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+HSTAT-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}} call failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_read_only_file_a649f32981a2419c6d0e335ee4b310bf1}{hstat()}} for a normal function returns \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} instead of throwing an exception when errors occur 

\mbox{\hyperlink{group__file__stat__constants}{File Stat Constants}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 this method was moved from the \mbox{\hyperlink{class_qore_1_1_file}{File}} class (where it is still available due to public inheritance) 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a649f32981a2419c6d0e335ee4b310bf1}\label{class_qore_1_1_read_only_file_a649f32981a2419c6d0e335ee4b310bf1}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!hstat@{hstat}}
\index{hstat@{hstat}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{hstat()}{hstat()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ Qore\+::\+Read\+Only\+File\+::hstat (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status or throws an exception if any errors occur. 

If any errors occur, a {\ttfamily FILE-\/\+HSTAT-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<StatInfo> h = file.hstat();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+HSTAT-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}} call failed or file not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{File\+::stat()}}
\item \mbox{\hyperlink{group__file__stat__constants}{File Stat Constants}} 
\end{DoxyItemize}
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a2b383f3c0d576ca17ec907f2e6cda43d}\label{class_qore_1_1_read_only_file_a2b383f3c0d576ca17ec907f2e6cda43d}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!hstat@{hstat}}
\index{hstat@{hstat}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{hstat()}{hstat()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ Qore\+::\+Read\+Only\+File\+::hstat (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status (follows symbolic links) or throws an exception if any errors occur. 

This method will follow symbolic links and return information about the target. If any errors occur, a {\ttfamily FILE-\/\+HSTAT-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<StatInfo> h = ReadOnlyFile::hstat(path);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the file to \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash about the file\textquotesingle{}s status
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+HSTAT-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}} call failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_read_only_file_a649f32981a2419c6d0e335ee4b310bf1}{hstat()}} for a normal function returns \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} instead of throwing an exception when errors occur 

\mbox{\hyperlink{group__file__stat__constants}{File Stat Constants}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 this method was moved from the \mbox{\hyperlink{class_qore_1_1_file}{File}} class (where it is still available due to public inheritance) 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a0bae6c89d6262b18785b0727866a3405}\label{class_qore_1_1_read_only_file_a0bae6c89d6262b18785b0727866a3405}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!isDataAvailable@{isDataAvailable}}
\index{isDataAvailable@{isDataAvailable}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{isDataAvailable()}{isDataAvailable()}}
{\footnotesize\ttfamily bool Qore\+::\+Read\+Only\+File\+::is\+Data\+Available (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0} }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{basic_data_types_True}{True}} if there is data available for reading from the file within the timeout period. 

With a timeout of zero (the default if no timeout value is passed), this method can be used for non-\/blocking polling the file for data. Like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} may be passed instead of an integer to make the timeout units clear (ex\+: {\ttfamily 25ms}).

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (!isDataAvailable(30s))}
\DoxyCodeLine{    \textcolor{keywordflow}{return};}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & An optional timeout in milliseconds (1/1000 second); \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time values}} can be given instead of an integer in milliseconds to make the source more readable; ex\+: {\ttfamily 20s} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if data becomes available for reading from the file within the timeout period, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a2744f4642700d0f273efbce43f709fb4}\label{class_qore_1_1_read_only_file_a2744f4642700d0f273efbce43f709fb4}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!isOpen@{isOpen}}
\index{isOpen@{isOpen}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{isOpen()}{isOpen()}}
{\footnotesize\ttfamily bool Qore\+::\+Read\+Only\+File\+::is\+Open (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns \mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file}{File}} is open, \mbox{\hyperlink{basic_data_types_False}{False}} if not 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file}{File}} is open, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = file.isOpen();}

\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_afd64015ff14cb58d2f2c365d36a9c85c}\label{class_qore_1_1_read_only_file_afd64015ff14cb58d2f2c365d36a9c85c}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!isTty@{isTty}}
\index{isTty@{isTty}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{isTty()}{isTty()}}
{\footnotesize\ttfamily bool Qore\+::\+Read\+Only\+File\+::is\+Tty (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns \mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file}{File}} is connected to a terminal device, \mbox{\hyperlink{basic_data_types_False}{False}} if not 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = file.isTty();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the \mbox{\hyperlink{class_qore_1_1_file}{File}} is connected to a terminal device, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_aebe2680d90eac6f78773106cac9e3aff}\label{class_qore_1_1_read_only_file_aebe2680d90eac6f78773106cac9e3aff}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!lstat@{lstat}}
\index{lstat@{lstat}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{lstat()}{lstat()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ Qore\+::\+Read\+Only\+File\+::lstat (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Returns a \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} about the given path\textquotesingle{}s status (does not follow symbolic links) or throws an exception if any errors occur. 

Does not follow symbolic links, but rather returns filesystem information for symbolic links. If any errors occur, a {\ttfamily FILE-\/\+LSTAT-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int mode = ReadOnlyFile::lstat(path)[2];}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the file to \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{group__filesystem__functions_stat_list}{list of file status values}} for the given file
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+LSTAT-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}} call failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__filesystem__functions_ga0ac877d2d854200d4f7eed50e6a71cf5}{lstat()}} for a similar function that does not throw exceptions when errors occur, but rather returns \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} 

\mbox{\hyperlink{group__file__stat__constants}{File Stat Constants}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 this method was moved from the \mbox{\hyperlink{class_qore_1_1_file}{File}} class (where it is still available due to public inheritance) 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a487b2f0b5b97ac8958eff649867f97ff}\label{class_qore_1_1_read_only_file_a487b2f0b5b97ac8958eff649867f97ff}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!open@{open}}
\index{open@{open}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{open()}{open()}}
{\footnotesize\ttfamily nothing Qore\+::\+Read\+Only\+File\+::open (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Opens a file in a particular mode; throws an exception on failure. 

Opens the file in the mode given; if the Read\+Only\+File was previously open, it is closed first. Optionally the Read\+Only\+File\textquotesingle{}s default character encoding can be specified.

Note that if no encoding is specified, the Read\+Only\+File will be tagged with the \mbox{\hyperlink{character_encoding}{character encoding}} set in the Read\+Only\+File\textquotesingle{}s \mbox{\hyperlink{class_qore_1_1_abstract_pollable_io_object_base_a772a2dc97dddb19a647ccdc863068d57}{constructor}}. Any string data written to the Read\+Only\+File will be converted to the Read\+Only\+File\textquotesingle{}s encoding, and any string data read from the Read\+Only\+File will be automatically tagged with the Read\+Only\+File\textquotesingle{}s encoding.

If an error occurs, a {\ttfamily READONLYFILE-\/\+OPEN-\/\+ERROR} exception is thrown.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{try} \{}
\DoxyCodeLine{    f.open(fn, \textcolor{stringliteral}{"{}iso-\/8859-\/1"{}});}
\DoxyCodeLine{\} catch (hash<ExceptionInfo> ex) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}\%s: \%s: \%s\(\backslash\)n"{}}, fn, ex.err, ex.desc);}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_OPEN_FILE}{EVENT\+\_\+\+OPEN\+\_\+\+FILE}}, \mbox{\hyperlink{event_handling_EVENT_FILE_OPENED}{EVENT\+\_\+\+FILE\+\_\+\+OPENED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the path to the file \\
\hline
{\em encoding} & the name of the \mbox{\hyperlink{character_encoding}{character encoding}} for the Read\+Only\+File; if this argument is not given, the Read\+Only\+File will be tagged with the \mbox{\hyperlink{character_encoding}{character encoding}} given in the \mbox{\hyperlink{class_qore_1_1_abstract_pollable_io_object_base_a772a2dc97dddb19a647ccdc863068d57}{constructor}}\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em READONLYFILE-\/\+OPEN-\/\+ERROR} & an error occurred opening the file \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_ac4475042a820d3d303b1b67f3921e728}\label{class_qore_1_1_read_only_file_ac4475042a820d3d303b1b67f3921e728}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!read@{read}}
\index{read@{read}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{read()}{read()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Read\+Only\+File\+::read (\begin{DoxyParamCaption}\item[{softint}]{size,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads a certain number of characters from the Read\+Only\+File within an optional timeout period and returns a string of the data read or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

Reads a certain amount of string data from the Read\+Only\+File; the size argument is required. To read binary data, use the \mbox{\hyperlink{class_qore_1_1_read_only_file_ac9513b569846b16e2b7363df5ba9f647}{Read\+Only\+File\+::read\+Binary()}} method.

Note that the amount of data read from the file may be less than the size given, for example if the file does not contain enough data to fulfill the request. In this case, only the data available in the file is returned.

An optional timeout period in milliseconds can be passed as well (or a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} may be passed instead of an integer to make the timeout units clear; ex\+: {\ttfamily 25ms}). If a timeout value is passed and the data cannot be read within the timeout period, then a {\ttfamily READONLYFILE-\/\+READ-\/\+TIMEOUT} exception is thrown. If no timeout value is passed or a negative value is given, then the call will never timeout until either the requested amount of data has been read from the Read\+Only\+File or an end-\/of-\/file condition has been reached.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*string data = f.read(-\/1); \textcolor{comment}{\# read an entire text file into a variable}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em size} & the number of characters to read of the file, -\/1 will read the entire file \\
\hline
{\em timeout\+\_\+ms} & a timeout period with a resolution of milliseconds (a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}}; integer arguments will be assumed to be milliseconds); if not given or negative the call will never time out and will only return when the data has been read\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the data read from the file, returned as a string tagged with the Read\+Only\+File\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}}. \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} is returned if end-\/of-\/file is encountered, however, if data has been read before EOF, the data read will be returned and \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} (signifying EOF) will be returned on the next call to this method.
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em READONLYFILE-\/\+READ-\/\+PARAMETER-\/\+ERROR} & zero size argument passed \\
\hline
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em FILE-\/\+READ-\/\+TIMEOUT} & timeout limit exceeded \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_read_only_file_ac9513b569846b16e2b7363df5ba9f647}{Read\+Only\+File\+::read\+Binary()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 this method uses character semantics instead of byte semantics 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_ac9513b569846b16e2b7363df5ba9f647}\label{class_qore_1_1_read_only_file_ac9513b569846b16e2b7363df5ba9f647}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readBinary@{readBinary}}
\index{readBinary@{readBinary}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readBinary()}{readBinary()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::\+Read\+Only\+File\+::read\+Binary (\begin{DoxyParamCaption}\item[{softint}]{size,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads a certain number of bytes from the file within an optional timeout period and returns a binary object of the data read or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

Reads a certain amount of string data from the file; the size argument is required. To read string data, use the \mbox{\hyperlink{class_qore_1_1_read_only_file_ac4475042a820d3d303b1b67f3921e728}{Read\+Only\+File\+::read()}} method.

Note that the amount of data read from the file may be less than the size given, for example if the file does not contain enough data to fulfill the request. In this case, only the data available in the file is returned.

An optional timeout period in milliseconds can be passed as well (or a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} may be passed instead of an integer to make the timeout units clear; ex\+: {\ttfamily 25ms}). If a timeout value is passed and the data cannot be read within the timeout period, then a {\ttfamily FILE-\/\+READ-\/\+TIMEOUT} exception is thrown. If no timeout value is passed or a negative value is given, then the call will never timeout until either the requested amount of data has been read from the file or an end-\/of-\/file condition has been reached.

\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*binary data = f.readBinary(-\/1); \textcolor{comment}{\# read an entire file into a variable}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em size} & the number of bytes to read of the file, -\/1 will read the entire file \\
\hline
{\em timeout\+\_\+ms} & a timeout period with a resolution of milliseconds (a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}}; integer arguments will be assumed to be milliseconds); if not given or negative the call will never time out and will only return when the data has been read\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the data read from the file, returned as a binary object. \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} is returned if end-\/of-\/file is encountered, however, if data has been read before EOF, the data read will be returned and \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} (signifying EOF) will be returned on the next call to this method.
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em READONLYFILE-\/\+READ-\/\+BINARY-\/\+PARAMETER-\/\+ERROR} & zero size argument passed \\
\hline
{\em FILE-\/\+READ-\/\+ERROR} & file is not open, or an I/O or other error occurred when reading the file\\
\hline
{\em FILE-\/\+READ-\/\+TIMEOUT} & timeout limit exceeded \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_read_only_file_ac4475042a820d3d303b1b67f3921e728}{Read\+Only\+File\+::read()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a149f83530ad4d521af205a711253662c}\label{class_qore_1_1_read_only_file_a149f83530ad4d521af205a711253662c}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readBinaryFile@{readBinaryFile}}
\index{readBinaryFile@{readBinaryFile}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readBinaryFile()}{readBinaryFile()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::\+Read\+Only\+File\+::read\+Binary\+File (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{max\+\_\+file\+\_\+len = {\ttfamily -\/1} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



returns the contents of a binary file as a binary object 

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{binary data = File::readBinaryFile(path);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the path of the file to retrieve \\
\hline
{\em max\+\_\+file\+\_\+len} & the maximum size of the file returned; if the data on the filesystem exceeds this value, the data returned will be truncated up to this byte length\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the contents of a binary file as a binary object
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & an I/O or other error occurred when reading the file\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}

\begin{DoxyItemize}
\item Qore 0.\+8.\+8 introduced this method
\item Qore 0.\+8.\+12 changed the behavior of the method; either a binary object (possibly an empty binary object for an empty file) will be returned, or an exception will be raised
\item Qore 0.\+9.\+3 added the {\itshape max\+\_\+file\+\_\+len} parameter 
\end{DoxyItemize}
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_afd50d3b67d82c8945bdb5a4684b1be21}\label{class_qore_1_1_read_only_file_afd50d3b67d82c8945bdb5a4684b1be21}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readi1@{readi1}}
\index{readi1@{readi1}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readi1()}{readi1()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readi1 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 1-\/byte signed integer from the file in binary format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readi1();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 1-\/byte signed integer as read from the file in binary format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a64ffeeac6c8365c6c5ab079930b07d44}\label{class_qore_1_1_read_only_file_a64ffeeac6c8365c6c5ab079930b07d44}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readi2@{readi2}}
\index{readi2@{readi2}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readi2()}{readi2()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readi2 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 2-\/byte (16 bit) signed integer from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readi2();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 2-\/byte signed integer as read from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_acfa7b5d8ddbb414aea45cd44e18c7b31}\label{class_qore_1_1_read_only_file_acfa7b5d8ddbb414aea45cd44e18c7b31}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readi2LSB@{readi2LSB}}
\index{readi2LSB@{readi2LSB}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readi2LSB()}{readi2LSB()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readi2\+LSB (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 2-\/byte (16 bit) signed integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readi2LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 2-\/byte signed integer as read from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_aaea5bb2ae5ab21d294cbba5bce380cdf}\label{class_qore_1_1_read_only_file_aaea5bb2ae5ab21d294cbba5bce380cdf}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readi4@{readi4}}
\index{readi4@{readi4}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readi4()}{readi4()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readi4 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 4-\/byte (32 bit) signed integer from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readi4();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 4-\/byte signed integer as read from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a5b0f2624f94f841f38c03acb0c9f6d0a}\label{class_qore_1_1_read_only_file_a5b0f2624f94f841f38c03acb0c9f6d0a}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readi4LSB@{readi4LSB}}
\index{readi4LSB@{readi4LSB}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readi4LSB()}{readi4LSB()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readi4\+LSB (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 4-\/byte (32 bit) signed integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readi4LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 4-\/byte signed integer as read from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a1e2026f6813d966c9f016a36cf500e83}\label{class_qore_1_1_read_only_file_a1e2026f6813d966c9f016a36cf500e83}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readi8@{readi8}}
\index{readi8@{readi8}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readi8()}{readi8()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readi8 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads an 8-\/byte (64 bit) signed integer from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readi8();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 8-\/byte signed integer as read from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_ae2b4ee10d080318b034b03db976220a5}\label{class_qore_1_1_read_only_file_ae2b4ee10d080318b034b03db976220a5}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readi8LSB@{readi8LSB}}
\index{readi8LSB@{readi8LSB}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readi8LSB()}{readi8LSB()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readi8\+LSB (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads an 8-\/byte (64 bit) signed integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readi8LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
an 8-\/byte signed integer as read from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a3407127e38d2a2ffe3c473d02561f788}\label{class_qore_1_1_read_only_file_a3407127e38d2a2ffe3c473d02561f788}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readLine@{readLine}}
\index{readLine@{readLine}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readLine()}{readLine()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Read\+Only\+File\+::read\+Line (\begin{DoxyParamCaption}\item[{bool}]{incl\+\_\+eol = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}},  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{eol }\end{DoxyParamCaption})}



Reads until an EOL marker is found and returns the string read or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

Any string returned will be tagged with the Read\+Only\+File\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}}.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{\# remove EOL marker}}
\DoxyCodeLine{\textcolor{keywordflow}{while} (exists (*string line = f.readLine(\textcolor{keyword}{False}))) \{}
\DoxyCodeLine{    \textcolor{comment}{\# print out the line just read}}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}}, line);}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em incl\+\_\+eol} & if this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the end of line characters read are included in the string returned \\
\hline
{\em eol} & the end of line character(s); if not given, then the end of line character(s) are detected automatically, and can be either {\ttfamily \char`\"{}\textbackslash{}n\char`\"{}}, {\ttfamily \char`\"{}\textbackslash{}r\char`\"{}}, or {\ttfamily \char`\"{}\textbackslash{}r\textbackslash{}n\char`\"{}} (the last one is only automatically detected when not connected to a terminal device in order to keep the I/O from stalling); if this string is passed and has a different \mbox{\hyperlink{character_encoding}{character encoding}} from the \mbox{\hyperlink{class_qore_1_1_file}{File}}\textquotesingle{}s, then it will be converted to the \mbox{\hyperlink{class_qore_1_1_file}{File}}\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The line read from the file. \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} is returned if end-\/of-\/file is encountered, however, if data has been read before EOF, the data read will be returned and \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} (signifying EOF) will be returned on the next call to this method. Any string returned will be tagged with the Read\+Only\+File\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}}.
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em READONLYFILE-\/\+READLINE-\/\+ERROR} & the file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_file_line_iterator}{Qore\+::\+File\+Line\+Iterator}} 
\end{DoxyItemize}
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a41a3763d813c0b7d41eec553819e1354}\label{class_qore_1_1_read_only_file_a41a3763d813c0b7d41eec553819e1354}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readTextFile@{readTextFile}}
\index{readTextFile@{readTextFile}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readTextFile()}{readTextFile()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Read\+Only\+File\+::read\+Text\+File (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{max\+\_\+file\+\_\+len = {\ttfamily -\/1} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



returns the contents of a text file as a string optionally tagged with the given \mbox{\hyperlink{character_encoding}{character encoding}} 

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string data = File::readTextFile(path);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the path of the file to retrieve \\
\hline
{\em encoding} & the name of the \mbox{\hyperlink{character_encoding}{character encoding}} for the string returned; if this argument is not given, then the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} is assumed \\
\hline
{\em max\+\_\+file\+\_\+len} & the maximum size of the file returned; if the data on the filesystem exceeds this value, the data returned will be truncated up to this byte length\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the contents of a text file as a string optionally tagged with the given \mbox{\hyperlink{character_encoding}{character encoding}} or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the file is empty or cannot be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & an I/O or other error occurred when reading the file\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}

\begin{DoxyItemize}
\item Qore 0.\+8.\+8 introduced this method
\item Qore 0.\+8.\+12 changed the behavior of the method; either a string (possibly an empty string for an empty file) will be returned, or an exception will be raised
\item Qore 0.\+9.\+3 added the {\itshape max\+\_\+file\+\_\+len} parameter 
\end{DoxyItemize}
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_adb1fb818dd189e65d5fb9eae59d497b2}\label{class_qore_1_1_read_only_file_adb1fb818dd189e65d5fb9eae59d497b2}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readu1@{readu1}}
\index{readu1@{readu1}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readu1()}{readu1()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readu1 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 1-\/byte unsigned integer from the Read\+Only\+File in binary format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readu1();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 1-\/byte unsigned integer as read from the Read\+Only\+File in binary format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a24582228c99f247ffbab087b35e5d8bc}\label{class_qore_1_1_read_only_file_a24582228c99f247ffbab087b35e5d8bc}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readu2@{readu2}}
\index{readu2@{readu2}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readu2()}{readu2()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readu2 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 2-\/byte (16 bit) unsigned integer from the Read\+Only\+File in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readu2();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 2-\/byte unsigned integer as read from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a385bd014878acbe7694439dff8b23d6c}\label{class_qore_1_1_read_only_file_a385bd014878acbe7694439dff8b23d6c}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readu2LSB@{readu2LSB}}
\index{readu2LSB@{readu2LSB}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readu2LSB()}{readu2LSB()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readu2\+LSB (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 2-\/byte (16 bit) unsigned integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readu2LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 2-\/byte unsigned integer as read from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_ad32a00cfec6f1c402b1190841cb95796}\label{class_qore_1_1_read_only_file_ad32a00cfec6f1c402b1190841cb95796}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readu4@{readu4}}
\index{readu4@{readu4}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readu4()}{readu4()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readu4 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 4-\/byte (32 bit) unsigned integer from the file in big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readu4();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 4-\/byte unsigned integer as read from the file in binary big-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a249229b21e021e85c8a854a91a728c68}\label{class_qore_1_1_read_only_file_a249229b21e021e85c8a854a91a728c68}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!readu4LSB@{readu4LSB}}
\index{readu4LSB@{readu4LSB}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{readu4LSB()}{readu4LSB()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::readu4\+LSB (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reads a 4-\/byte (32 bit) unsigned integer from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*int i = f.readu4LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_DATA_READ}{EVENT\+\_\+\+DATA\+\_\+\+READ}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a 4-\/byte unsigned integer as read from the file in binary little-\/endian format or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no data can be read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+READ-\/\+ERROR} & file is not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_ac5ed072e0e98c0b8f497724423be5ecd}\label{class_qore_1_1_read_only_file_ac5ed072e0e98c0b8f497724423be5ecd}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!setEncoding@{setEncoding}}
\index{setEncoding@{setEncoding}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{setEncoding()}{setEncoding()}}
{\footnotesize\ttfamily nothing Qore\+::\+Read\+Only\+File\+::set\+Encoding (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Sets the \mbox{\hyperlink{character_encoding}{character encoding}} for the Read\+Only\+File; if called with no argument, the \mbox{\hyperlink{character_encoding_default_encoding}{default encoding}} is set. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{f.setEncoding(\textcolor{stringliteral}{"{}ISO-\/8859-\/1"{}});}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em encoding} & the \mbox{\hyperlink{character_encoding}{character encoding}} for the file; if called with no argument, the \mbox{\hyperlink{character_encoding_default_encoding}{default encoding}} is set\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a44207327eadce535f46cbfcba1bff28a}\label{class_qore_1_1_read_only_file_a44207327eadce535f46cbfcba1bff28a}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!setEventQueue@{setEventQueue}}
\index{setEventQueue@{setEventQueue}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{setEventQueue()}{setEventQueue()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Read\+Only\+File\+::set\+Event\+Queue (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Removes any \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object from the Read\+Only\+File object so that \mbox{\hyperlink{class_qore_1_1_file_file_events}{file events}} are no longer added to the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{f.setEventQueue();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{event_handling}{I/O Event Handling}} for more information 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a7e7420155a764474130f364693d90954}\label{class_qore_1_1_read_only_file_a7e7420155a764474130f364693d90954}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!setEventQueue@{setEventQueue}}
\index{setEventQueue@{setEventQueue}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{setEventQueue()}{setEventQueue()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Read\+Only\+File\+::set\+Event\+Queue (\begin{DoxyParamCaption}\item[{Queue}]{queue,  }\item[{auto}]{arg,  }\item[{\+\_\+\+\_\+7\+\_\+ bool}]{with\+\_\+data }\end{DoxyParamCaption})}



Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive \mbox{\hyperlink{class_qore_1_1_file_file_events}{file events}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{f.setEventQueue(queue);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em queue} & the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive \mbox{\hyperlink{class_qore_1_1_file_file_events}{file events}}; note that the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} passed cannot have any maximum size set or a QUEUE-\/\+ERROR will be thrown \\
\hline
{\em arg} & an argument that will be included in each event hash in the {\itshape arg} key \\
\hline
{\em with\+\_\+data} & if \mbox{\hyperlink{basic_data_types_True}{True}}, then the actual raw data transferred / received is also included in the events\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
{\em QUEUE-\/\+ERROR} & the Queue passed has a maximum size set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{event_handling}{I/O Event Handling}} for more information
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+9.\+4 added the {\itshape arg} and {\itshape with\+\_\+data} options 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a34b10ef0bdee5bda118d3923367aea4d}\label{class_qore_1_1_read_only_file_a34b10ef0bdee5bda118d3923367aea4d}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!setPos@{setPos}}
\index{setPos@{setPos}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{setPos()}{setPos()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Read\+Only\+File\+::set\+Pos (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{pos = {\ttfamily 0} }\end{DoxyParamCaption})}



Sets the current file position (in bytes from the beginning of the file) 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{f.setPos(0); \textcolor{comment}{\# go to the beginning of the file}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em pos} & the position in the file as offset from position 0\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the new offset in the file, -\/1 for error
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_read_only_file_a995bc1347bebfff19439425a569d96d6}{Read\+Only\+File\+::get\+Pos()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}\label{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!stat@{stat}}
\index{stat@{stat}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{stat()}{stat()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ Qore\+::\+Read\+Only\+File\+::stat (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} about the file\textquotesingle{}s status or throws an exception if any errors occur. 

If any errors occur, a {\ttfamily FILE-\/\+STAT-\/\+ERROR} exception is thrown.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int mode = file.stat()[2];}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{group__filesystem__functions_stat_list}{list of file status values}} for the current file (must be open).
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+STAT-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}} call failed or file not open \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_read_only_file_a649f32981a2419c6d0e335ee4b310bf1}{File\+::hstat()}}
\item \mbox{\hyperlink{group__file__stat__constants}{File Stat Constants}} 
\end{DoxyItemize}
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a770673d2a8a03471ae184e45d41b8264}\label{class_qore_1_1_read_only_file_a770673d2a8a03471ae184e45d41b8264}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!stat@{stat}}
\index{stat@{stat}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{stat()}{stat()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ auto $>$ Qore\+::\+Read\+Only\+File\+::stat (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Returns a \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} about the file\textquotesingle{}s status (follows symbolic links) or throws an exception if any errors occur. 

This method will follow symbolic links and return information about the target. If any errors occur, a {\ttfamily FILE-\/\+STAT-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int mode = ReadOnlyFile::stat(path)[2];}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the file to \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{group__filesystem__functions_stat_list}{list of file status values}} for the given file
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+STAT-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_aeb484661ef0fdacb6a8dfe07bde4b729}{stat()}} call failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__file__stat__constants}{File Stat Constants}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 this method was moved from the \mbox{\hyperlink{class_qore_1_1_file}{File}} class (where it is still available due to public inheritance) 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_a6681ce768d279f359a4d74ab58e40a16}\label{class_qore_1_1_read_only_file_a6681ce768d279f359a4d74ab58e40a16}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!statvfs@{statvfs}}
\index{statvfs@{statvfs}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{statvfs()}{statvfs()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} $>$ Qore\+::\+Read\+Only\+File\+::statvfs (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash about the file\textquotesingle{}s filesystem status or throws an exception if any errors occur. 

If any errors occur, a {\ttfamily FILE-\/\+STATVFS-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Platform Availability\+:}
\mbox{\hyperlink{group__option__constants_gaa2928b4710b3dd34f7bf5a9ba52e7548}{Qore\+::\+Option\+::\+HAVE\+\_\+\+STATVFS}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<FilesystemInfo> h = file.statvfs();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash about the filesystem where the file resides
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+STATVFS-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_a6681ce768d279f359a4d74ab58e40a16}{statvfs()}} call failed or file is not open \\
\hline
{\em MISSING-\/\+FEATURE-\/\+ERROR} & this method is not supported on this platform; check \mbox{\hyperlink{group__option__constants_gaa2928b4710b3dd34f7bf5a9ba52e7548}{Option\+::\+HAVE\+\_\+\+STATVFS}} before calling this method to avoid this exception \\
\hline
{\em ILLEGAL-\/\+EXPRESSION} & this exception is only thrown if called with a system constant object (\mbox{\hyperlink{group__io__constants_ga0cfa7aea34f3c921036623600e42b21f}{stdin}}, \mbox{\hyperlink{group__io__constants_ga44ab38fe66ed7aa87731a2de976017c6}{stdout}}, \mbox{\hyperlink{group__io__constants_ga697e4968984d273562f14bfed155b4a8}{stderr}}) when \mbox{\hyperlink{parse_directives_no-terminal-io}{no-\/terminal-\/io}} is set \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_read_only_file_aebe7a731a705ffc50c869873d13fc650}\label{class_qore_1_1_read_only_file_aebe7a731a705ffc50c869873d13fc650}} 
\index{Qore::ReadOnlyFile@{Qore::ReadOnlyFile}!statvfs@{statvfs}}
\index{statvfs@{statvfs}!Qore::ReadOnlyFile@{Qore::ReadOnlyFile}}
\doxysubsubsection{\texorpdfstring{statvfs()}{statvfs()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} $>$ Qore\+::\+Read\+Only\+File\+::statvfs (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Returns a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash about filesystem status of the given path; throws an exception if any errors occur. 

If any errors occur, a {\ttfamily FILE-\/\+STATVFS-\/\+ERROR} exception is thrown

\begin{DoxyParagraph}{Platform Availability\+:}
\mbox{\hyperlink{group__option__constants_gaa2928b4710b3dd34f7bf5a9ba52e7548}{Qore\+::\+Option\+::\+HAVE\+\_\+\+STATVFS}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<FilesystemInfo> h = ReadOnlyFile::statvfs(path);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & the path to the filesystem to check \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash about the filesystem where the file resides
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em FILE-\/\+STATVFS-\/\+ERROR} & \mbox{\hyperlink{class_qore_1_1_read_only_file_a6681ce768d279f359a4d74ab58e40a16}{statvfs()}} call failed \\
\hline
{\em MISSING-\/\+FEATURE-\/\+ERROR} & this method is not supported on this platform; check \mbox{\hyperlink{group__option__constants_gaa2928b4710b3dd34f7bf5a9ba52e7548}{Option\+::\+HAVE\+\_\+\+STATVFS}} before calling this method to avoid this exception\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 this method was moved from the \mbox{\hyperlink{class_qore_1_1_file}{File}} class (where it is still available due to public inheritance) 
\end{DoxySince}
