text: public static PackIndex Read(InputStream fd){byte[] hdr = new byte[8];IOUtil.ReadFully(fd, hdr, 0, hdr.Length);if (IsTOC(hdr)){int v = NB.DecodeInt32(hdr, 4);switch (v){case 2:{return new PackIndexV2(fd);}default:{throw new IOException(MessageFormat.Format(JGitText.Get().unsupportedPackIndexVersion, Sharpen.Extensions.ValueOf(v)));}}}return new PackIndexV1(fd, hdr);}