Skip to content
Evan Swick edited this page Feb 19, 2016 · 2 revisions

A Stream is a protocol used for reading and writing to sequential data streams.

Variables

  • canRead: Bool
    • Whether this stream supports being read from
  • canWrite: Bool
    • Whether this stream supports being written to
  • canTimeout: Bool
    • Whether this stream supports timing out
  • canSeek: Bool
    • Whether this stream supports seeking
  • position: Int64
    • The stream's current position
  • readTimeout: UInt
    • The time (in milliseconds) a read operation must complete by
  • writeTimeout: UInt
    • The time (in milliseconds) a write operation must complete by

Functions

  • read(count: Int64) throws -> [UInt8]
    • Attempts to read count or less bytes from the stream
  • write(bytes: [UInt8]) throws -> Int
    • Attempts to write bytes to the stream, returning the number of bytes successfully written
  • seek(offset: Int64, origin: SeekOrigin) throws
    • Attempts to move the stream's position offset bytes from origin
  • close() throws
    • Attempts to close the stream
Clone this wiki locally