BER messages can be directly read and decoded from an input stream such as a file, network or memory stream using BER streaming decode functions. The ASN1C compiler -stream option is used to generate decoders of this type. For each ASN.1 production defined in an ASN.1 source file, a C streaming decode function is generated. This function will decode an ASN.1 message into a C variable of the given type.
If C++ code generation is specified, a control class is generated that contains a DecodeFrom method that wraps this function. This function is invoked through the class interface to decode an ASN.1 message into the variable referenced in the msgData component of the class.
In this version, there are three types of streams: file, socket and memory. The most useful are file and socket streams. It is possible to decode data directly from a file or socket without intermediate copying into memory. If the full amount of data is not available for reading then the behavior of these streams will be different: the file and memory input streams will report an error, the socket input stream will block until data is available or an I/O error occurs (for example, the remote side closes the connection).