\hypertarget{class_qore_1_1_input_stream}{}\doxysection{Qore\+::Input\+Stream Class Reference} \label{class_qore_1_1_input_stream}\index{Qore::InputStream@{Qore::InputStream}} This class defines an abstract interface for input streams. Inheritance diagram for Qore\+::Input\+Stream\+: % FIG 0 \doxysubsection*{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 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 abstract \+\_\+\+\_\+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}} limit) \begin{DoxyCompactList}\small\item\em Reads bytes (up to a specified limit) from the input stream; returns \mbox{\hyperlink{basic_data_types_NOTHING}{NOTHING}} if there are no more bytes in the stream. \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} \mbox{\hyperlink{class_qore_1_1_stream_reader}{Stream\+Reader}} for a class that can be used to \mbox{\hyperlink{class_qore_1_1_input_stream_a74ba0bc85bb86988a0f8b3255d1dbf01}{read}} various kinds of data from an \mbox{\hyperlink{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 \mbox{\hyperlink{class_qore_1_1_stream_base_a017fc847a42d5c670cb9640a94522666}{Stream\+Base\+::unassign\+Thread()}} method in the thread that currently owns the stream, and the \mbox{\hyperlink{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} \mbox{\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 \mbox{\hyperlink{namespace_qore}{Qore}} programming language. \mbox{\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 abstract \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Input\+Stream\+::peek (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}} 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} Implemented in \mbox{\hyperlink{class_qore_1_1_transform_input_stream_afd099588b751a10d855184f13c5f64b1}{Qore\+::\+Transform\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_string_input_stream_a226b6d889b17fe20a9d09aa81fe9b529}{Qore\+::\+String\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_pipe_input_stream_a1bbdc70f26a18e3fd78dd87477d6138e}{Qore\+::\+Pipe\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_file_input_stream_a898981029547b903c7a2ac661b621443}{Qore\+::\+File\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_encoding_conversion_input_stream_ac6565e3291b08c9556e28aeed7e2a87a}{Qore\+::\+Encoding\+Conversion\+Input\+Stream}}, and \mbox{\hyperlink{class_qore_1_1_binary_input_stream_af7f129b397b9b41479874b2dd0db8a8d}{Qore\+::\+Binary\+Input\+Stream}}. \mbox{\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 abstract \+\_\+\+\_\+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})\hspace{0.3cm}{\ttfamily [pure virtual]}} Reads bytes (up to a specified limit) from the input stream; returns \mbox{\hyperlink{basic_data_types_NOTHING}{NOTHING}} 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 \mbox{\hyperlink{basic_data_types_NOTHING}{NOTHING}} 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{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}Read: \%y\(\backslash\)n"{}}, b);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} Implemented in \mbox{\hyperlink{class_qore_1_1_transform_input_stream_a46852a829ac6f3d72cb5bb18867b5366}{Qore\+::\+Transform\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_string_input_stream_a2ec22e63a510f7438cb677936a6dbc49}{Qore\+::\+String\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_pipe_input_stream_a262618fb179b875385f49993a90baa07}{Qore\+::\+Pipe\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_file_input_stream_a51429f08b73a1cac82cca23de4dc6c9c}{Qore\+::\+File\+Input\+Stream}}, \mbox{\hyperlink{class_qore_1_1_encoding_conversion_input_stream_a9155d46e1e3343d19583d0bd735d1f11}{Qore\+::\+Encoding\+Conversion\+Input\+Stream}}, and \mbox{\hyperlink{class_qore_1_1_binary_input_stream_a8efc82cb091d29d856d638170fb046c0}{Qore\+::\+Binary\+Input\+Stream}}.