if (_position == 0)
return;
- StreamWriter writer = new StreamWriter (stream);
- writer.Write (buffer, 0, _position);
- writer.Flush ();
+ byte[] bytesToWrite =_encoding.GetBytes (buffer, 0, _position);
+ stream.Write (bytesToWrite, 0, bytesToWrite.Length);
}
}
// Write to the filter, which will call us back, and then Flush
filtering = true;
try {
- StreamWriter wr = new StreamWriter (filter, response.ContentEncoding);
- wr.Write (buffer, offset, count);
+ byte [] bytesToWrite = response.ContentEncoding.GetBytes (buffer, offset, count);
+ filter.Write (bytesToWrite, 0, bytesToWrite.Length);
}
finally {
filtering = false;
// Write to the filter, which will call us back, and then Flush
filtering = true;
try {
- StreamWriter wr = new StreamWriter (filter, response.ContentEncoding);
- wr.Write (s, offset, count);
+ byte [] bytesToWrite = response.ContentEncoding.GetBytes (s.ToCharArray (), offset, count);
+ filter.Write (bytesToWrite, 0, bytesToWrite.Length);
}
finally {
filtering = false;