public synchronized void write(byte[] buffer, int offset, int length) throws IOException {checkNotClosed();if (buffer == null) {throw new NullPointerException("buffer == null");}byte[] internalBuffer = buf;if (length >= internalBuffer.length) {flushInternal();out.write(buffer, offset, length);return;}Arrays.checkOffsetAndCount(buffer.length, offset, length);if (length > (internalBuffer.length - count)) {flushInternal();}System.arraycopy(buffer, offset, internalBuffer, count, length);count += length;}

public override void write(byte[] buffer, int offset, int length){lock (this){checkNotClosed();if (buffer == null){throw new System.ArgumentNullException("buffer == null");}byte[] internalBuffer = buf;if (length >= internalBuffer.Length){flushInternal();@out.write(buffer, offset, length);return;}java.util.Arrays.checkOffsetAndCount(buffer.Length, offset, length);if (length > (internalBuffer.Length - count)){flushInternal();}System.Array.Copy(buffer, offset, internalBuffer, count, length);count += length;}}
