MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / peek

Method peek

src/org/kxml2/io/KXmlParser.java:861–898  ·  view source on GitHub ↗

Does never read more than needed

(int pos)

Source from the content-addressed store, hash-verified

859 /** Does never read more than needed */
860
861 private final int peek(int pos) throws IOException {
862
863 while (pos >= peekCount) {
864
865 int nw;
866
867 if (srcBuf.length <= 1)
868 nw = reader.read();
869 else if (srcPos < srcCount)
870 nw = srcBuf[srcPos++];
871 else {
872 srcCount = reader.read(srcBuf, 0, srcBuf.length);
873 if (srcCount <= 0)
874 nw = -1;
875 else
876 nw = srcBuf[0];
877
878 srcPos = 1;
879 }
880
881 if (nw == '\r') {
882 wasCR = true;
883 peek[peekCount++] = '\n';
884 }
885 else {
886 if (nw == '\n') {
887 if (!wasCR)
888 peek[peekCount++] = '\n';
889 }
890 else
891 peek[peekCount++] = nw;
892
893 wasCR = false;
894 }
895 }
896
897 return peek[pos];
898 }
899
900 private final String readName()
901 throws IOException, XmlPullParserException {

Callers 8

nextImplMethod · 0.95
parseLegacyMethod · 0.95
peekTypeMethod · 0.95
parseStartTagMethod · 0.95
pushTextMethod · 0.95
readMethod · 0.95
readNameMethod · 0.95
skipMethod · 0.95

Calls 1

readMethod · 0.45

Tested by

no test coverage detected