ReadableStream
public protocol ReadableStream: class, TextOutputStreamable, CommandRunning
A stream of text. Does as much as possible lazily.
-
Undocumented
Declaration
Swift
public protocol ReadableStream: class, TextOutputStreamable, CommandRunning -
Undocumented
Declaration
Swift
public protocol ReadableStream: class, TextOutputStreamable, CommandRunning -
readSome()Default implementationAll the text the stream contains so far. 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.
Default Implementation
Reads everything at once.
Declaration
Swift
func readSome() -> String?Return Value
more text from the stream, or nil if we have reached the end.
-
read()Default implementationReads everything at once.
Default Implementation
Reads everything at once.
Declaration
Swift
func read() -> String
-
lines()Extension methodSplits stream lazily into lines.
Declaration
Swift
public func lines() -> LazySequence<AnySequence<String>> -
write(to:)Extension methodWrites the text in this file to the given TextOutputStream.
Declaration
Swift
public func write<Target: TextOutputStream>(to target: inout Target) -
contextExtension methodUndocumented
Declaration
Swift
public protocol ReadableStream: class, TextOutputStreamable, CommandRunning
-
onOutput(handler:)Extension methodhandlerwill be called whenever there is new output available. Passnilto remove any preexisting handlers. - Note: if the stream is read from outside of the handler, or more than once inside the handler, it may be called once when stream is closed and empty.Declaration
Swift
public func onOutput ( handler: ((ReadableStream) -> ())? ) -
onStringOutput(handler:)Extension methodhandlerwill be called whenever there is new text output available. Passnilto remove any preexisting handlers. - Note: if the stream is read from outside of the handler, or more than once inside the handler, it may be called once when stream is closed and empty.Declaration
Swift
public func onStringOutput ( handler: ((String) -> ())? )
View on GitHub
ReadableStream Protocol Reference