Imported async stream from https://code.google.com/p/async-ostream/