public int next() throws NoSuchElementException { final int v = iter.next(); return v > 255 ? '?' : v; }
public int next() { if (! hasNext()) throw new NoSuchElementException(); offset++; return iter.next(); }
/** * Drain all the remaining code points in this iterator to the given string builder. * * @param b the string builder * @return the same string builder */ public StringBuilder drainTo(StringBuilder b) { while (hasNext()) { b.appendCodePoint(next()); } return b; }
public int next() { if (! hasNext()) { throw new NoSuchElementException(); } offset++; return iter.next(); }
public int next() { if (! hasNext()) { throw new NoSuchElementException(); } return iter.next(); }
/** * Skip all the remaining code points in this iterator. * (Useful in combination with {@link #delimitedBy(int...)}) * * @return the same code point iterator */ public CodePointIterator skipAll() { while (hasNext()) next(); return this; }
public ByteStringBuilder appendAscii(CodePointIterator iterator) { int cp; while (iterator.hasNext()) { cp = iterator.next(); if (cp > 127) throw new IllegalArgumentException(); append((byte) cp); } return this; }
public ByteStringBuilder appendLatin1(CodePointIterator iterator) { int cp; while (iterator.hasNext()) { cp = iterator.next(); if (cp > 255) throw new IllegalArgumentException(); append((byte) cp); } return this; }
public ByteStringBuilder appendUtf8(CodePointIterator iterator) { while (iterator.hasNext()) { appendUtf8Raw(iterator.next()); } return this; }
private static CipherSuitePredicate parseAndPredicate(CipherSuitePredicate item, final CodePointIterator i) { final ArrayList<CipherSuitePredicate> list = new ArrayList<>(); list.add(item); do { list.add(getSimplePredicateByName(i.delimitedBy('+', ':', ',', ' ').drainToString())); } while (i.hasNext() && i.next() == '+'); return CipherSuitePredicate.matchAll(list.toArray(new CipherSuitePredicate[list.size()])); }
private String nameFor(Path path) { String fileName = path.toString(); fileName = fileName.substring(0, fileName.length() - 4); // remove ".xml" if (encoded) { CodePointIterator it = CodePointIterator.ofString(fileName); it.delimitedBy('-').skipAll(); it.next(); // skip '-' fileName = it.base32Decode(Base32Alphabet.STANDARD, false) .asUtf8String().drainToString(); } return fileName; }
public int peekPrevious() throws NoSuchElementException { if (! hasPrevious()) { throw new NoSuchElementException(); } int b1 = iter.previous(); int b0 = iter.peekPrevious(); iter.next(); return calc(b0, b1); }
private static Password parseUnixDESCryptPasswordString(char[] cryptString) throws InvalidKeySpecException { assert cryptString.length == 13; // previously tested by doIdentifyAlgorithm CodePointIterator r = CodePointIterator.ofChars(cryptString); // 12 bit salt int s0 = MOD_CRYPT.decode(r.next()); int s1 = MOD_CRYPT.decode(r.next()); short salt = (short) (s0 | s1 << 6); // 64 bit hash byte[] hash = r.base64Decode(MOD_CRYPT, false).limitedTo(8).drain(); return UnixDESCryptPassword.createRaw(UnixDESCryptPassword.ALGORITHM_CRYPT_DES, salt, hash); }
private static void skipDelims(CodePointIterator di, CodePointIterator cpi, int...delims) throws AcmeException { while ((! di.hasNext()) && cpi.hasNext()) { if (! isDelim(cpi.next(), delims)) { throw acme.invalidContentTypeFromAcmeServer(); } } }
private static void skipDelims(CodePointIterator di, CodePointIterator cpi, int... delims) { while ((! di.hasNext()) && cpi.hasNext() && isDelim(cpi.peekNext(), delims)) { cpi.next(); } } }
private static void skipDelims(CodePointIterator di, CodePointIterator cpi, int...delims) throws IllegalArgumentException { while ((! di.hasNext()) && cpi.hasNext()) { if (! isDelim(cpi.next(), delims)) { throw log.invalidCertificateExtensionStringValue(); } } }
private int seekPrev(int prev) throws NoSuchElementException { if (! iter.hasPrevious()) { return prev; } prev = iter.previous(); if (skip(prev)) { return seekPrev(prev); } iter.next(); return prev; }
private int seekNext(int next) throws NoSuchElementException { if (! iter.hasNext()) { return next; } next = iter.next(); if (skip(next)) { return seekNext(next); } iter.previous(); return next; }
public static void skipDelims(CodePointIterator di, CodePointIterator cpi, int...delims) throws SaslException { while ((! di.hasNext()) && cpi.hasNext()) { if (! isDelim(cpi.next(), delims)) { throw saslOTP.mechInvalidMessageReceived().toSaslException(); } } }
private static CipherSuitePredicate parsePredicate(final CodePointIterator i, final String word) { CipherSuitePredicate item = getSimplePredicateByName(word); if (i.hasNext() && i.next() == '+') { if (item == null) { throw ElytronMessages.log.mechSelectorTokenNotAllowed("+", i.getIndex(), i.drainToString()); } return parseAndPredicate(item, i); } else { return item; } }