\hypertarget{class_qore_1_1_encoding_conversion_input_stream}{}\section{Qore\+::Encoding\+Conversion\+Input\+Stream Class Reference}
\label{class_qore_1_1_encoding_conversion_input_stream}\index{Qore::EncodingConversionInputStream@{Qore::EncodingConversionInputStream}}


An \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} implementation that performs on-\/the-\/fly conversion between two character encodings.  




Inheritance diagram for Qore\+::Encoding\+Conversion\+Input\+Stream\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=225pt]{class_qore_1_1_encoding_conversion_input_stream__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_encoding_conversion_input_stream_a0f2dc6c5d837ea820fcf15047a59afd1}{constructor}} (\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}} is, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} source\+Encoding, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} dest\+Encoding)
\begin{DoxyCompactList}\small\item\em Creates the \mbox{\hyperlink{class_qore_1_1_encoding_conversion_input_stream}{Encoding\+Conversion\+Input\+Stream}} based on the \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} given. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_encoding_conversion_input_stream_ac6565e3291b08c9556e28aeed7e2a87a}{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 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{class_qore_1_1_encoding_conversion_input_stream_a9155d46e1e3343d19583d0bd735d1f11}{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{group__null__and__nothing__constants_ga756badc783adcd6a850808b928e21af4}{N\+O\+T\+H\+I\+NG}} if there are no more bytes in the stream. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
An \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} implementation that performs on-\/the-\/fly conversion between two character encodings. 

\begin{DoxyParagraph}{Example\+: Encoding\+Conversion\+Input\+Stream basic usage}

\begin{DoxyCode}{0}
\DoxyCodeLine{EncodingConversionInputStream latin2Stream(sourceUtf8Stream, \textcolor{stringliteral}{"UTF-8"}, \textcolor{stringliteral}{"ISO-8859-2"});}
\DoxyCodeLine{binary *b;}
\DoxyCodeLine{\textcolor{keywordflow}{while} (b = latin2Stream.read(20)) \{}
\DoxyCodeLine{    \textcolor{comment}{\#b contains up to 20 bytes representing latin-2 characters}}
\DoxyCodeLine{\}}
\end{DoxyCode}

\end{DoxyParagraph}
\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 S\+T\+R\+E\+A\+M-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} 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{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_encoding_conversion_input_stream_a9155d46e1e3343d19583d0bd735d1f11}{read}} various kinds of data from an \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}


\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_encoding_conversion_input_stream_a0f2dc6c5d837ea820fcf15047a59afd1}\label{class_qore_1_1_encoding_conversion_input_stream_a0f2dc6c5d837ea820fcf15047a59afd1}} 
\index{Qore::EncodingConversionInputStream@{Qore::EncodingConversionInputStream}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::EncodingConversionInputStream@{Qore::EncodingConversionInputStream}}
\subsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+Encoding\+Conversion\+Input\+Stream\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}}}]{is,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{source\+Encoding,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{dest\+Encoding }\end{DoxyParamCaption})}



Creates the \mbox{\hyperlink{class_qore_1_1_encoding_conversion_input_stream}{Encoding\+Conversion\+Input\+Stream}} based on the \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} given. 


\begin{DoxyParams}{Parameters}
{\em is} & the source \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} to read bytes from \\
\hline
{\em source\+Encoding} & the encoding of the characters in the source input stream \\
\hline
{\em dest\+Encoding} & the destination character encoding \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em E\+N\+C\+O\+D\+I\+N\+G-\/\+C\+O\+N\+V\+E\+R\+S\+I\+O\+N-\/\+E\+R\+R\+OR} & if either of the encodings is unsupported \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_encoding_conversion_input_stream_ac6565e3291b08c9556e28aeed7e2a87a}\label{class_qore_1_1_encoding_conversion_input_stream_ac6565e3291b08c9556e28aeed7e2a87a}} 
\index{Qore::EncodingConversionInputStream@{Qore::EncodingConversionInputStream}!peek@{peek}}
\index{peek@{peek}!Qore::EncodingConversionInputStream@{Qore::EncodingConversionInputStream}}
\subsubsection{\texorpdfstring{peek()}{peek()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Encoding\+Conversion\+Input\+Stream\+::peek (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [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{EncodingConversionInputStream latin2Stream(sourceUtf8Stream, \textcolor{stringliteral}{"UTF-8"}, \textcolor{stringliteral}{"ISO-8859-2"});}
\DoxyCodeLine{int nextByte = latin2Stream.peek();}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em E\+N\+C\+O\+D\+I\+N\+G-\/\+C\+O\+N\+V\+E\+R\+S\+I\+O\+N-\/\+E\+R\+R\+OR} & if an invalid multibyte sequence is encountered in the input \\
\hline
{\em S\+T\+R\+E\+A\+M-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}


Implements \mbox{\hyperlink{class_qore_1_1_input_stream_a165db4108c3a1f4bbb6b619972fd131c}{Qore\+::\+Input\+Stream}}.

\mbox{\Hypertarget{class_qore_1_1_encoding_conversion_input_stream_a9155d46e1e3343d19583d0bd735d1f11}\label{class_qore_1_1_encoding_conversion_input_stream_a9155d46e1e3343d19583d0bd735d1f11}} 
\index{Qore::EncodingConversionInputStream@{Qore::EncodingConversionInputStream}!read@{read}}
\index{read@{read}!Qore::EncodingConversionInputStream@{Qore::EncodingConversionInputStream}}
\subsubsection{\texorpdfstring{read()}{read()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::\+Encoding\+Conversion\+Input\+Stream\+::read (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{limit }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Reads bytes (up to a specified limit) from the input stream; returns \mbox{\hyperlink{group__null__and__nothing__constants_ga756badc783adcd6a850808b928e21af4}{N\+O\+T\+H\+I\+NG}} 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{group__null__and__nothing__constants_ga756badc783adcd6a850808b928e21af4}{N\+O\+T\+H\+I\+NG}} if no more bytes are available
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{EncodingConversionInputStream latin2Stream(sourceUtf8Stream, \textcolor{stringliteral}{"UTF-8"}, \textcolor{stringliteral}{"ISO-8859-2"});}
\DoxyCodeLine{*binary b;}
\DoxyCodeLine{\textcolor{keywordflow}{while} (b = latin2Stream.read(20)) \{}
\DoxyCodeLine{    \textcolor{comment}{\#b contains up to 20 bytes representing latin-2 characters}}
\DoxyCodeLine{\}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em E\+N\+C\+O\+D\+I\+N\+G-\/\+C\+O\+N\+V\+E\+R\+S\+I\+O\+N-\/\+E\+R\+R\+OR} & if an invalid multibyte sequence is encountered in the input \\
\hline
{\em I\+N\+P\+U\+T-\/\+S\+T\+R\+E\+A\+M-\/\+E\+R\+R\+OR} & {\itshape limit} is not positive \\
\hline
{\em S\+T\+R\+E\+A\+M-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}


Implements \mbox{\hyperlink{class_qore_1_1_input_stream_a74ba0bc85bb86988a0f8b3255d1dbf01}{Qore\+::\+Input\+Stream}}.

