# Poco

# template < typename ch, typename tr >

# class BasicUnbufferedStreamBuf

Library: Foundation
Package: Streams
Header: Poco/UnbufferedStreamBuf.h

## Description

This is an implementation of an unbuffered streambuf that greatly simplifies the implementation of custom streambufs of various kinds. Derived classes only have to override the methods readFromDevice() or writeToDevice().

## Inheritance

Direct Base Classes: std::basic_streambuf < ch, tr >

All Base Classes: std::basic_streambuf < ch, tr >

## Member Summary

Member Functions: charToInt, overflow, pbackfail, uflow, underflow, xsgetn

## Types

### Base

typedef std::basic_streambuf < ch, tr > Base;

### IOS

typedef std::basic_ios < ch, tr > IOS;

### char_traits

typedef tr char_traits;

### char_type

typedef ch char_type;

### int_type

typedef typename Base::int_type int_type;

### off_type

typedef typename Base::off_type off_type;

### openmode

typedef typename IOS::openmode openmode;

### pos_type

typedef typename Base::pos_type pos_type;

## Constructors

### BasicUnbufferedStreamBuf

BasicUnbufferedStreamBuf();

## Destructor

### ~BasicUnbufferedStreamBuf

~BasicUnbufferedStreamBuf();

## Member Functions

### overflow

virtual int_type overflow(
int_type c
);

### pbackfail

virtual int_type pbackfail(
int_type c
);

### uflow

virtual int_type uflow();

### underflow

virtual int_type underflow();

### xsgetn

virtual std::streamsize xsgetn(
char_type * p,
std::streamsize count
);

Some platforms (for example, Compaq C++) have buggy implementations of xsgetn that handle null buffers incorrectly. Anyway, it does not hurt to provide an optimized implementation of xsgetn for this streambuf implementation.

### charToInt

static int_type charToInt(
char_type c
);