/// <exception cref="System.IO.IOException"></exception> internal virtual int ReadLength() { IOUtil.ReadFully(@in, lineBuffer, 0, 4); try { int len = RawParseUtils.ParseHexInt16(lineBuffer, 0); if (len != 0 && len < 4) { throw new IndexOutOfRangeException(); } return(len); } catch (IndexOutOfRangeException) { throw new IOException(MessageFormat.Format(JGitText.Get().invalidPacketLineHeader , string.Empty + (char)lineBuffer[0] + (char)lineBuffer[1] + (char)lineBuffer[2] + (char)lineBuffer[3])); } }