# Poco

# template < typename ch, typename tr >

# class BasicMemoryStreamBuf

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

## Description

BasicMemoryStreamBuf is a simple implementation of a stream buffer for reading and writing from a memory area.

This streambuf only supports unidirectional streams. In other words, the BasicMemoryStreamBuf 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: charsWritten, overflow, reset, sync, underflow

## 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;

### pos_type

typedef typename Base::pos_type pos_type;

## Constructors

### BasicMemoryStreamBuf

BasicMemoryStreamBuf(
char_type * pBuffer,
std::streamsize bufferSize
);

## Destructor

### ~BasicMemoryStreamBuf

~BasicMemoryStreamBuf();

## Member Functions

### charsWritten

std::streamsize charsWritten() const;

### overflow

virtual int_type overflow(
int_type
);

### reset

void reset();

Resets the buffer so that current read and write positions will be set to the beginning of the buffer.

### sync

virtual int sync();

### underflow

virtual int_type underflow();