# Poco

# class StreamConverterBuf

Library: Foundation
Package: Text
Header: Poco/StreamConverter.h

## Description

A StreamConverter converts streams from one encoding (inEncoding) into another (outEncoding). If a character cannot be represented in outEncoding, defaultChar is used instead. If a byte sequence is not valid in inEncoding, defaultChar is used instead and the encoding error count is incremented.

## Inheritance

Direct Base Classes: UnbufferedStreamBuf

All Base Classes: UnbufferedStreamBuf

## Member Summary

Member Functions: errors, readFromDevice, writeToDevice

## Constructors

### StreamConverterBuf

StreamConverterBuf(
std::istream & istr,
const TextEncoding & inEncoding,
const TextEncoding & outEncoding,
int defaultChar = '?'
);

Creates the StreamConverterBuf and connects it to the given input stream.

### StreamConverterBuf

StreamConverterBuf(
std::ostream & ostr,
const TextEncoding & inEncoding,
const TextEncoding & outEncoding,
int defaultChar = '?'
);

Creates the StreamConverterBuf and connects it to the given output stream.

## Destructor

### ~StreamConverterBuf

~StreamConverterBuf() override;

Destroys the StreamConverterBuf.

## Member Functions

### errors

int errors() const;

Returns the number of encoding errors encountered.

### readFromDevice

int readFromDevice() override;

### writeToDevice

int writeToDevice(
char c
) override;