The Ada.Streams package, hereafter referred to simply as the Streams package, introduced into Ada 95 a standard mechanism for the storage and transmission of heterogeneous data within and amongst Ada programs. Section 13.13 of the Ada 95 LRM defines the streams features of the language, specifying the programmatic interface and behavior of this capability. It states that a "stream type may be implemented in various ways, such as an external sequential file, an internal buffer, or network channel." The Ada standard then goes on to define in Appendix A.12 the packages Streams.Stream_IO, Text_IO.Text_Streams, and Wide_Text_IO.Text_Streams, which provide stream-oriented operations on files.Files, however, are merely one option for the implementation of stream-based communication. By suitably extending the Stream package's Root_Stream_Type and providing corresponding Read and Write procedures, a stream can be associated with any communication or storage medium. Applications employing the standard stream-oriented attributes defined in LRM 13.13.2 can transparently communicate, store, or load data items as governed by the application's extension of a stream.This paper illustrates and implements a simple socket-based extension of a stream to demonstrate the flexibility of the Ada 95 Stream capability and the ease with which streams can be associated with other communication media.
/lp/association-for-computing-machinery/a-socket-based-manifestation-of-streams-bEtq8SN0QW