public override void Write(byte[] buffer, int offset, int count) { if (compressionMode != CompressionMode.Compress || compressor == null) { throw new InvalidOperationException("Cannot write if not Set to compression mode."); } if (buffer.Length < count) { throw new InvalidOperationException(); } for (int i = 0; i < count; i += BLOCK_SIZE) { stream.WriteByte(CompressedType); compressor.WriteUncomressedLength(buffer, 1, count); int compressedLength = compressor.CompressInternal(buffer, offset, count, internalBuffer, 2); stream.Write(internalBuffer, 0, compressedLength + 3); } }