ReadableStream

public protocol ReadableStream: class, TextOutputStreamable

A stream of text. Does as much as possible lazily.

  • Undocumented

    Declaration

    Swift

    public protocol ReadableStream: class, TextOutputStreamable
  • Whatever amount of text the stream feels like providing. If the source is a file this will read everything at once. - returns: more text from the stream, or nil if we have reached the end.

    Declaration

    Swift

    func readSome() -> String?

    Return Value

    more text from the stream, or nil if we have reached the end.

  • Reads everything at once.

    Declaration

    Swift

    func read() -> String
  • lines() Extension method

    Splits stream lazily into lines.

    Declaration

    Swift

    public func lines() -> LazySequence<AnySequence<String>>
  • write(to:) Extension method

    Writes the text in this file to the given TextOutputStream.

    Declaration

    Swift

    public func write<Target: TextOutputStream>(to target: inout Target)