Moved code from Stdio to Impl of StdioWriter