ARTICLE
Classes and Interfaces for Streams
The classes and interfaces of streams are in the
SABP_STREAMS_AND_LOCATORS package. Interfaces and classes that have
been released for use are exposed in their package interface
SABP_STREAMS_AND_LOCATORS . The following figure shows the hierarchy
of the most important interfaces and classes for streams.
Classes for Data Streams and Filter Streams
The classes for data streams and filter streams are the templates for
data stream objects and filter stream objects.
The classes for the "data stream" stream kind start with "CL_ABAP_"
, followed by
an identification resource , for the resource, which is used as a
data source or a
data drain . At the moment, data streams
are supported for the following resources:
LOBs in database tables; the associated
resource ID is " DB " .
Strings ; the associated resource ID is "
STRING " .
Internal tables ; the associated
resource ID is " ITAB " .
an identification type for the stream type. Here the
identifications "C" and "X" are possible for the binary
streams and character streams.
an identification direction for the stream direction. Here the
identifications "READER" and "WRITER" are possible for
reader streams or writer streams.
The classes for the "filter stream" stream kind start with
"CL_ABAP_FILTER_" , followed by the identifications type and
direction with the same meanings as for data stream classes. At
present, no filter streams have been implemented.
Interfaces and Superclasses
All public methods of the data stream and filter stream classes are
declared in interfaces which allow general access to the classes.
The IF_ABAP_direction interface enables general access to all
reader and writer streams.
The IF_ABAP_type_direction interface enables a type-dependent
access to reader and writer streams.
The IF_ABAP_resource_direction interface enables
resource-dependent access to reader and writer streams.
The IF_ABAP_CLOSE_RESOURCE interface contains the CLOSE
method, which is required by all stream kinds in order to close an open
resource. This also applies for filter streams, since these are usually
connected to data streams and the resource can then only be closed using
the filter stream.
Data stream classes inherit CL_ABAP_type_direction from abstract
superclasses. In these, methods are implemented, which are dependent on
stream type and stream direction but independent of the resource.
Important Methods
In the case of data streams, the following methods are implemented as
kernel methods . This means that access
to the data source or
data drain is completed by the ABAP runtime
environment.
Methods for Reader Streams
Methods from the IF_ABAP_READER
interface:
DATA_AVAILABLE returns "X", if there is still data in the reader
stream.
IS_X_READER returns "X", if it is a binary stream.
READ returns a string with a predefined number of bytes or
characters from the reader stream.
SKIP skips a predefined number of bytes or characters from the
reader stream.
Methods for Writer Streams
Methods from the IF_ABAP_WRITER
interface:
WRITE writes the content of a specified string to a writer
stream.
Methods for Both Stream Kinds
Methods from the IF_ABAP_CLOSE_RESOURCE
interface:
CLOSE closes the stream.
IS_CLOSED returns "X" if the stream is closed.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved