WrappedOutputStream

class WrappedOutputStream : OutputStream, StreamDelegate

This class wraps an output stream.

This somehow helps handling output streams. Looks like one cannot direcly use a sub-classed output stream, so there is a stream kept as an internal variable. In addition there is a computed property to return this variable. That way it can be overwritten by sub classe. Maybe there is a better way to handle this.

  • The internal output stream.

    Declaration

    Swift

    let _stream: OutputStream
  • Returns the internal output stream.

    Declaration

    Swift

    var stream: OutputStream { get }
  • The internal delegate.

    Declaration

    Swift

    weak var _delegate: StreamDelegate?
  • Initialize a wrapped stream with a given output stream.

    Declaration

    Swift

    init(_ stream: OutputStream)

    Parameters

    stream

    The output stream.

  • Delegate function for the wrapped stream.

    Declaration

    Swift

    func stream(_ aStream: Stream, handle eventCode: Stream.Event)

    Parameters

    aStream

    The stream calling the delegate. Has to be the wrapped output stream.

    eventCode

    The event that occurred.