/// <exception cref="System.IO.IOException"/> private int _readMore(Sharpen.InputStream @in, byte[] readBuffer, int inputPtr, int inputEnd, int maxRead) { // anything to shift to front? int i = 0; while (inputPtr < inputEnd) { readBuffer[i++] = readBuffer[inputPtr++]; } inputPtr = 0; inputEnd = i; maxRead = System.Math.min(maxRead, readBuffer.Length); do { int length = maxRead - inputEnd; if (length == 0) { break; } int count = @in.read(readBuffer, inputEnd, length); if (count < 0) { return inputEnd; } inputEnd += count; } while (inputEnd < 3); return inputEnd; }