Index

Package: Buffers

Description

package Streams.Buffers is

Classes

Buffer_Stream

type Buffer_Stream is new Root_Stream_Type with private;

Ancestors:

Ada.Streams.Root_Stream_Type

Primitive operations:

Read (overriding Ada.Streams.Read)
Write (overriding Ada.Streams.Write)
A Buffer_Stream is a stream implementation backed by a read-only buffer. The stream can be wrapped around an existing buffer to read its contents (use Stream constructor function), or a buffer can be consumed into the stream and freed automatically when the stream is closed (use Open_Stream constructor procedure).

Types

A_Buffer_Stream

type A_Buffer_Stream is access all Buffer_Stream'Class;

Subprograms & Entries

Open_Stream

procedure Open_Stream
( buffer: in out A_SEA;
stream: out A_Buffer_Stream );
Creates a Buffer_Stream backed by 'buffer', which is consumed by this procedure. Closing the stream will deallocate the buffer.

Stream

function Stream
( buffer: not null A_SEA ) return A_Buffer_Stream;
Creates a Buffer_Stream wrapper around 'buffer'. The stream depends on the existance of buffer so be sure to call Close on the stream before deallocating the buffer.

Close

procedure Close
( stream: in out A_Buffer_Stream );
Closes the stream and deallocates its buffer (if it had ownership of it, given by calling Open_Stream.)