\doxysection{Qore\+::Input\+Stream Class Reference}
\hypertarget{class_qore_1_1_input_stream}{}\label{class_qore_1_1_input_stream}\index{Qore::InputStream@{Qore::InputStream}}


This class defines an abstract interface for input streams.  




{\ttfamily \#include $<$QC\+\_\+\+Input\+Stream.\+dox.\+h$>$}



Inheritance diagram for Qore\+::Input\+Stream\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{class_qore_1_1_input_stream__inherit__graph}
\end{center}
\end{figure}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_input_stream_afa843e81a854eeb13f215a76da80cea4}{constructor}} ()
\begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_input_stream_a165db4108c3a1f4bbb6b619972fd131c}{peek}} ()
\begin{DoxyCompactList}\small\item\em Peeks the next byte available from the input stream; returns -\/1 if no more data available. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{\+\_\+\+\_\+7\+\_\+}} \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{class_qore_1_1_input_stream_a74ba0bc85bb86988a0f8b3255d1dbf01}{read}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{limit}})
\begin{DoxyCompactList}\small\item\em Reads bytes (up to a specified limit) from the input stream; returns \doxysectlink{basic_data_types_NOTHING}{NOTHING}{2} if there are no more bytes in the stream. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \mbox{\hyperlink{class_qore_1_1_stream_base}{Qore\+::\+Stream\+Base}}}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_stream_base_ae1c3dbffc3da7bdc8e16e8ad41302552}{constructor}} ()
\begin{DoxyCompactList}\small\item\em Throws an exception if called directly; this class can only be instantiated by builtin subclasses. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} {\bfseries get\+Thread\+Id} ()
\begin{DoxyCompactList}\small\item\em Get the currently assigned thread id or -\/1 if not assigned to any thread. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} \mbox{\hyperlink{class_qore_1_1_stream_base_ab6b33cb1944c46aca8e9984ddfd65452}{reassign\+Thread}} ()
\begin{DoxyCompactList}\small\item\em Reassigns current thread as thread used for stream manipulation. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} \mbox{\hyperlink{class_qore_1_1_stream_base_a017fc847a42d5c670cb9640a94522666}{unassign\+Thread}} ()
\begin{DoxyCompactList}\small\item\em Unassigns current thread as thread used for stream manipulation. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This class defines an abstract interface for input streams. 

Classes inheriting this class can be used to read bytes from various sources.

\begin{DoxySeeAlso}{See also}
\doxylink{class_qore_1_1_stream_reader}{Stream\+Reader} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{for} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{a} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{class} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{that} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{can} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{be} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{used} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{to} \doxylink{class_qore_1_1_input_stream_a74ba0bc85bb86988a0f8b3255d1dbf01}{read} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{various} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{kinds} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{of} data \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{from} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{an} \doxylink{class_qore_1_1_input_stream}{Input\+Stream}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
stream classes are not designed to be accessed from multiple threads; they have been implemented without locking for fast and efficient use when used from a single thread. For methods that would be unsafe to use in another thread, any use of such methods in threads other than the thread where the constructor was called will cause a {\ttfamily STREAM-\/\+THREAD-\/\+ERROR} to be thrown, unless the stream is handed off to another thread using the \doxylink{class_qore_1_1_stream_base_a017fc847a42d5c670cb9640a94522666}{Stream\+Base\+::unassign\+Thread()} method in the thread that currently owns the stream, and the \doxylink{class_qore_1_1_stream_base_ab6b33cb1944c46aca8e9984ddfd65452}{Stream\+Base\+::reassign\+Thread()} method in the new thread.
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}


\doxysubsection{Member Function Documentation}
\Hypertarget{class_qore_1_1_input_stream_afa843e81a854eeb13f215a76da80cea4}\label{class_qore_1_1_input_stream_afa843e81a854eeb13f215a76da80cea4} 
\index{Qore::InputStream@{Qore::InputStream}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::InputStream@{Qore::InputStream}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+Input\+Stream\+::constructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Constructor. 

Used by subclasses defined in the \doxylink{namespace_qore}{Qore} programming language. \Hypertarget{class_qore_1_1_input_stream_a165db4108c3a1f4bbb6b619972fd131c}\label{class_qore_1_1_input_stream_a165db4108c3a1f4bbb6b619972fd131c} 
\index{Qore::InputStream@{Qore::InputStream}!peek@{peek}}
\index{peek@{peek}!Qore::InputStream@{Qore::InputStream}}
\doxysubsubsection{\texorpdfstring{peek()}{peek()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Input\+Stream\+::peek (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Peeks the next byte available from the input stream; returns -\/1 if no more data available. 

\begin{DoxyReturn}{Returns}
the next byte available from the input stream or -\/1 if no more data is available
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int\ nextByte\ =\ is.peek();}

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_input_stream_a74ba0bc85bb86988a0f8b3255d1dbf01}\label{class_qore_1_1_input_stream_a74ba0bc85bb86988a0f8b3255d1dbf01} 
\index{Qore::InputStream@{Qore::InputStream}!read@{read}}
\index{read@{read}!Qore::InputStream@{Qore::InputStream}}
\doxysubsubsection{\texorpdfstring{read()}{read()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{\+\_\+\+\_\+7\+\_\+}} \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::\+Input\+Stream\+::read (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{limit }\end{DoxyParamCaption})}



Reads bytes (up to a specified limit) from the input stream; returns \doxysectlink{basic_data_types_NOTHING}{NOTHING}{2} if there are no more bytes in the stream. 


\begin{DoxyParams}{Parameters}
{\em limit} & the maximum number of bytes to read \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the read bytes (the length is between 1 and \`{}limit\`{} inclusive) or \doxysectlink{basic_data_types_NOTHING}{NOTHING}{2} if no more bytes are available
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*binary\ b;}
\DoxyCodeLine{\textcolor{keywordflow}{while}\ (b\ =\ is.read(10))\ \{}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}Read:\ \%y\(\backslash\)n"{}},\ b);}
\DoxyCodeLine{\}}

\end{DoxyCode}
 
\end{DoxyParagraph}
