Allow serialization to streams without creating an intermediate byte array