FileInputStream

public protocol FileInputStream : LuaWrapper, Closeable

File input stream.

  • Reads the given amount of bytes (length) to the buffer. Returns the read amount of bytes (0 on EOF).

    Declaration

    Swift

    func read(_ buffer: UnsafeMutablePointer<UInt8>, length: Int) throws -> Int
  • readAsData(bufferSize:) Extension method

    Reads the whole stream as a Data.

    Declaration

    Swift

    func readAsData(bufferSize: Int = 8192) throws -> Data
  • Reads the whole stream as a String with a given encoding.

    Declaration

    Swift

    func readAsString(bufferSize: Int = 8192, encoding: String.Encoding = .utf8) throws -> String