/// <summary>\r
/// \r
/// </summary>\r
- internal sealed class OutputStreamWrapper : java.io.Writer\r
+ public sealed class OutputStreamWrapper : java.io.Writer\r
{\r
enum OutputMode\r
{\r
readonly OutputStream _outputStream;\r
readonly OutputMode _outputMode;\r
\r
- private byte [] _bytebuffer = new byte [1024];\r
- private char [] _charBuffer = new char [1024];\r
- sbyte [] _oneByte = new sbyte [1];\r
+ private byte [] _bytebuffer;\r
+ private char [] _charBuffer;\r
+ //sbyte [] _oneByte = new sbyte [1];\r
\r
Encoding _encoding = null;\r
\r
private char [] GetCharBuffer (int length)\r
{\r
// We will reuse the buffer if its size is < 32K\r
- if (_charBuffer.Length >= length)\r
+ if (_charBuffer != null && _charBuffer.Length >= length)\r
return _charBuffer;\r
\r
if (length > 32 * 1024)\r
return new char [length];\r
\r
+ if (length < 1024)\r
+ length = 1024;\r
+\r
_charBuffer = new char [length];\r
return _charBuffer;\r
}\r
private byte [] GetByteBuffer (int length)\r
{\r
// We will reuse the buffer if its size is < 32K\r
- if (_bytebuffer.Length >= length)\r
+ if (_bytebuffer != null && _bytebuffer.Length >= length)\r
return _bytebuffer;\r
\r
if (length > 32 * 1024)\r
return new byte [length];\r
\r
+ if (length < 1024)\r
+ length = 1024;\r
+\r
_bytebuffer = new byte [length];\r
return _bytebuffer;\r
}\r