Answer to http://stackoverflow.com/questions/19424104/segmented-filestream-write