Convert between chunk encoded stream and decoded stream