Index

Package: Buffers

Description

package Streams.Buffers is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Buffer_Stream

type Buffer_Stream is new Root_Stream_Type with private;

Ancestors:

Root_Stream_Type

Primitive operations:

Read (overriding Read)
Write (overriding 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.

Stream

function Stream
( buffer: String ) return A_Buffer_Stream;
Creates a Buffer_Stream wrapper around a copy of 'buffer'. It is recommended that only Characters be read from this type of buffer stream.

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.)