 
         return try writeData(data)
     }
-}
+
+    public func writeChar(_ character: UnicodeScalar) throws -> Int{
+        let stringEquiv = String(character)
+        let bytesWritten = try writeString(stringEquiv)
+        return bytesWritten
+    }
+}

        }

        while true {
        	let bytesRead = try readBytes(into: buffer, size: 1)

        	if bytesRead > 0 {
        		let character = CChar(buffer[0])
                
                if character == terminator {
                    break
                } else {
                    data.append(buffer, count: 1)
                }
        	}
        }

        if let string = String(data: data, encoding: String.Encoding.utf8) {

            data = Data(bytes: buffer, count: bytesRead)
        } else {
            //This is to avoid the case where bytesRead can be negative causing problems allocating the Data buffer
            data = Data(bytes: buffer, count: 0)
        }

        return data
