public override void Flush() { if (lastFlushPosition == position) { return; } if (bufferIndex == streamBuffer.Length) { storage.WriteBuffer(blockIndex, streamBuffer); } else { byte[] tempBuffer = new byte[bufferIndex]; Buffer.BlockCopy(streamBuffer, 0, tempBuffer, 0, (int)bufferIndex); storage.WriteBuffer(blockIndex, tempBuffer); } lastFlushPosition = position; }