@ Nullable private char [ ] _peekChars ( @ Nonnegative final int nPos ) { if ( nPos < 0 || nPos >= limit ( ) ) return null ; final char c1 = get ( nPos ) ; if ( Character . isHighSurrogate ( c1 ) && nPos < limit ( ) ) { final char c2 = get ( nPos + 1 ) ; if ( Character . isLowSurrogate ( c2 ) ) return new char [ ] { c1 , c2 } ; throw new InvalidCharacterException ( c2 ) ; } if ( Character . isLowSurrogate ( c1 ) && nPos > 1 ) { final char c2 = get ( nPos - 1 ) ; if ( Character . isHighSurrogate ( c2 ) ) return new char [ ] { c2 , c1 } ; throw new InvalidCharacterException ( c2 ) ; } return new char [ ] { c1 } ; }
Peek the specified chars in the iterator . If the codepoint is not supplemental the char array will have a single member . If the codepoint is supplemental the char array will have two members representing the high and low surrogate chars