\doxysection{Qore\+::Encoding\+Conversion\+Output\+Stream Class Reference}
\hypertarget{class_qore_1_1_encoding_conversion_output_stream}{}\label{class_qore_1_1_encoding_conversion_output_stream}\index{Qore::EncodingConversionOutputStream@{Qore::EncodingConversionOutputStream}}


An \doxylink{class_qore_1_1_output_stream}{Output\+Stream} implementation that performs on-\/the-\/fly conversion between two character encodings.  




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



Inheritance diagram for Qore\+::Encoding\+Conversion\+Output\+Stream\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=225pt]{class_qore_1_1_encoding_conversion_output_stream__inherit__graph}
\end{center}
\end{figure}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} \mbox{\hyperlink{class_qore_1_1_encoding_conversion_output_stream_ae46c9f9987f43b585c0b79f67b698a12}{close}} ()
\begin{DoxyCompactList}\small\item\em Flushes any buffered (unwritten) bytes, closes the output stream and releases all resources. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_encoding_conversion_output_stream_adc11259814f1b833a773ef8ef0310e50}{constructor}} (\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{os}}, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{source\+Encoding}}, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{dest\+Encoding}})
\begin{DoxyCompactList}\small\item\em Creates the \doxylink{class_qore_1_1_encoding_conversion_output_stream}{Encoding\+Conversion\+Output\+Stream} based on the \doxylink{class_qore_1_1_output_stream}{Output\+Stream} given. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} \mbox{\hyperlink{class_qore_1_1_encoding_conversion_output_stream_a0b8b4433ed50a89b3b1b44d7305abb48}{write}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} data)
\begin{DoxyCompactList}\small\item\em Writes bytes to the output stream. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}}}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} \mbox{\hyperlink{class_qore_1_1_output_stream_a2125e17612767b9636554b282638e883}{close}} ()
\begin{DoxyCompactList}\small\item\em Flushes any buffered (unwritten) bytes, closes the output stream and releases all resources. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_output_stream_a451b37ada0ac9331fd2c62c68dcbe286}{constructor}} ()
\begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} \mbox{\hyperlink{class_qore_1_1_output_stream_a9054b0475c4829d10f956d8f6df6f2ac}{write}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} data)
\begin{DoxyCompactList}\small\item\em Writes bytes to the output 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}
An \doxylink{class_qore_1_1_output_stream}{Output\+Stream} implementation that performs on-\/the-\/fly conversion between two character encodings. 

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

\begin{DoxyCode}{0}
\DoxyCodeLine{EncodingConversionOutputStream\ latin2Stream(destUtf8Stream,\ \textcolor{stringliteral}{"{}ISO-\/8859-\/2"{}},\ \textcolor{stringliteral}{"{}UTF-\/8"{}});}
\DoxyCodeLine{latin2Stream.write(latin2Data);\ \ \ \ \ \textcolor{comment}{\#writes\ UTF-\/8\ equivalents\ to\ destUtf8Stream}}

\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 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{DoxySeeAlso}{See also}
\doxylink{class_qore_1_1_stream_writer}{Stream\+Writer} \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_encoding_conversion_output_stream_a0b8b4433ed50a89b3b1b44d7305abb48}{write} \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}{to} \doxylink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{an} \doxylink{class_qore_1_1_output_stream}{Output\+Stream}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}


\doxysubsection{Member Function Documentation}
\Hypertarget{class_qore_1_1_encoding_conversion_output_stream_ae46c9f9987f43b585c0b79f67b698a12}\label{class_qore_1_1_encoding_conversion_output_stream_ae46c9f9987f43b585c0b79f67b698a12} 
\index{Qore::EncodingConversionOutputStream@{Qore::EncodingConversionOutputStream}!close@{close}}
\index{close@{close}!Qore::EncodingConversionOutputStream@{Qore::EncodingConversionOutputStream}}
\doxysubsubsection{\texorpdfstring{close()}{close()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} Qore\+::\+Encoding\+Conversion\+Output\+Stream\+::close (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Flushes any buffered (unwritten) bytes, closes the output stream and releases all resources. 

Any methods called on a closed output stream will throw an exception.


\begin{DoxyExceptions}{Exceptions}
{\em OUTPUT-\/\+STREAM-\/\+CLOSED-\/\+ERROR} & the output stream has already been closed \\
\hline
{\em STREAM-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\Hypertarget{class_qore_1_1_encoding_conversion_output_stream_adc11259814f1b833a773ef8ef0310e50}\label{class_qore_1_1_encoding_conversion_output_stream_adc11259814f1b833a773ef8ef0310e50} 
\index{Qore::EncodingConversionOutputStream@{Qore::EncodingConversionOutputStream}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::EncodingConversionOutputStream@{Qore::EncodingConversionOutputStream}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+Encoding\+Conversion\+Output\+Stream\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}}}]{os,  }\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 \doxylink{class_qore_1_1_encoding_conversion_output_stream}{Encoding\+Conversion\+Output\+Stream} based on the \doxylink{class_qore_1_1_output_stream}{Output\+Stream} given. 


\begin{DoxyParams}{Parameters}
{\em os} & the destination \doxylink{class_qore_1_1_output_stream}{Output\+Stream} to write bytes to \\
\hline
{\em source\+Encoding} & the encoding of the characters that will be written to this stream \\
\hline
{\em dest\+Encoding} & the destination character encoding that will be written to the underlying \doxylink{class_qore_1_1_output_stream}{Output\+Stream} os \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em ENCODING-\/\+CONVERSION-\/\+ERROR} & if either of the encodings is unsupported \\
\hline
\end{DoxyExceptions}
\Hypertarget{class_qore_1_1_encoding_conversion_output_stream_a0b8b4433ed50a89b3b1b44d7305abb48}\label{class_qore_1_1_encoding_conversion_output_stream_a0b8b4433ed50a89b3b1b44d7305abb48} 
\index{Qore::EncodingConversionOutputStream@{Qore::EncodingConversionOutputStream}!write@{write}}
\index{write@{write}!Qore::EncodingConversionOutputStream@{Qore::EncodingConversionOutputStream}}
\doxysubsubsection{\texorpdfstring{write()}{write()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{nothing}} Qore\+::\+Encoding\+Conversion\+Output\+Stream\+::write (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{data }\end{DoxyParamCaption})}



Writes bytes to the output stream. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to write\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{EncodingConversionOutputStream\ ecos();}
\DoxyCodeLine{bos.write(<6162>);}
\DoxyCodeLine{bos.write(<63>);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em OUTPUT-\/\+STREAM-\/\+CLOSED-\/\+ERROR} & the output stream has already been closed \\
\hline
{\em STREAM-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
