# 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, operator =, overflow, reset, seekoff, seekpos, sync, underflow

## Types Aliases

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

### pos_type

using pos_type = typename Base::pos_type;

## Constructors

### BasicMemoryStreamBuf

BasicMemoryStreamBuf() = delete;

### BasicMemoryStreamBuf

BasicMemoryStreamBuf(
const BasicMemoryStreamBuf & param302
) = delete;

### BasicMemoryStreamBuf

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

## Destructor

### ~BasicMemoryStreamBuf

~BasicMemoryStreamBuf() override = default;

## Member Functions

### charsWritten

std::streamsize charsWritten() const;

### operator =

BasicMemoryStreamBuf & operator = (
const BasicMemoryStreamBuf & param303
) = delete;

### overflow

int_type overflow(
int_type
) override;

### reset

void reset();

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

### seekoff

pos_type seekoff(
off_type off,
std::ios_base::seekdir way,
std::ios_base::openmode which = std::ios_base::in | std::ios_base::out
) override;

### seekpos

pos_type seekpos(
pos_type pos,
std::ios_base::openmode which = std::ios_base::in | std::ios_base::out
) override;

### sync

int sync() override;

### underflow

int_type underflow() override;