# Poco

# template < typename ch, typename tr, typename ba = BufferAllocator < ch >>

# class BasicBufferedStreamBuf

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

## Description

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

This streambuf only supports unidirectional streams. In other words, the BasicBufferedStreamBuf can be used for the implementation of an istream or an ostream, but not for an iostream.

## Inheritance

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

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

## Member Summary

Member Functions: getMode, operator =, overflow, setMode, sync, underflow, xsgetn

## Types Aliases

### Allocator

using Allocator = ba;

### Base

using Base = std::basic_streambuf < ch, tr >;

### IOS

using IOS = std::basic_ios < ch, tr >;

### char_traits

using char_traits = tr;

### char_type

using char_type = ch;

### int_type

using int_type = typename Base::int_type;

### off_type

using off_type = typename Base::off_type;

### openmode

using openmode = typename IOS::openmode;

### pos_type

using pos_type = typename Base::pos_type;

## Constructors

### BasicBufferedStreamBuf

BasicBufferedStreamBuf(
const BasicBufferedStreamBuf & param210
) = delete;

### BasicBufferedStreamBuf

BasicBufferedStreamBuf(
std::streamsize bufferSize,
openmode mode
);

## Destructor

### ~BasicBufferedStreamBuf

~BasicBufferedStreamBuf() override;

## Member Functions

### operator =

BasicBufferedStreamBuf & operator = (
const BasicBufferedStreamBuf & param211
) = delete;

### overflow

int_type overflow(
int_type c
) override;

### sync

int sync() override;

### underflow

int_type underflow() override;

### xsgetn

std::streamsize xsgetn(
char_type * buffer,
std::streamsize length
) override;

Bulk read override. The default streambuf::xsgetn calls sbumpc() per byte; this override copies directly from the internal buffer and refills via readFromDevice() as needed.

### getMode

openmode getMode() const;

### setMode

void setMode(
openmode mode
);