# io.BytesIO

#### class io.BytesIO ( \[*initial\_bytes*] )

Реализация потока с использованием байтового буфера в памяти. Он наследует BufferedIOBase. Буфер удаляется при вызове метода close ().

Необязательный аргумент ***initial\_bytes*** - это байтовый объект (*bytes-like object* ), содержащий начальные данные.

**BytesIO** предоставляет или переопределяет эти методы в дополнение к методам из [BufferedIOBase](https://treasuremaster.gitbook.io/python-docs/obshie-sluzhby-operacionnoi-sistemy/io/io.bufferediobase) и IOBase:

* getbuffer ()
* [getvalue ()](https://treasuremaster.gitbook.io/python-docs/obshie-sluzhby-operacionnoi-sistemy/io/io.bytesio/io.bytesio.getvalue) - возвращает все байты, содержащиеся в буфере
* read1 ()
* readinto1 ()


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://treasuremaster.gitbook.io/python-docs/moduli-standartnoi-biblioteki-1/obshie-sluzhby-operacionnoi-sistemy/io/io.bytesio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
