Add null stream implementation
Change swrite return type from int to size_t