private int seekNext() { for (int i = 0; i < iterators.length; i ++) { if (iterators[i].hasNext()) { return i; } } return -1; }
public boolean hasNext() { return state == 0 && iter.hasNext() || state > 0 && state < 0xd; }
public boolean hasNext() { return iter.hasNext(); }
public boolean hasNext() { return iter.hasNext(); }
public boolean hasNext() { return iter.hasNext(); }
public boolean hasNext() { return iter.hasNext(); }
public boolean hasNext() { return state == 0 && iter.hasNext() || state > 0 && state < 0x29; }
public boolean hasNext() { return lo || iter.hasNext(); }
public boolean hasNext() { return offset < size && iter.hasNext(); }
public int read(final byte[] b, final int off, final int len) throws IOException { if (len == 0) return 0; if (! iter.hasNext()) return - 1; return iter.drain(b, off, len); } }
/** * Get this byte iterator as a UTF-8 string. * * @return the code point iterator */ public CodePointIterator asUtf8String() { if (! hasNext()) { return CodePointIterator.EMPTY; } return new Utf8DecodingIterator(this); }
/** * Drain all the remaining bytes in this iterator to the given stream. * * @param stream the stream * @return the same stream */ public ByteArrayOutputStream drainTo(ByteArrayOutputStream stream) { while (hasNext()) { stream.write(next()); } return stream; }
/** * Return a copy of this iterator which is limited to the given number of bytes after the current one. Advancing * the returned iterator will also advance this one. * * @param size the number of bytes * @return the limited byte iterator */ public final ByteIterator limitedTo(final int size) { if (size <= 0 || ! hasNext()) { return EMPTY; } return new LimitedByteIterator(this, size); }
public int read() throws IOException { return iter.hasNext() ? iter.next() : - 1; }
/** * Get this byte iterator as a Latin-1 string. * * @return the code point iterator */ public CodePointIterator asLatin1String() { if (! hasNext()) { return CodePointIterator.EMPTY; } return new Latin1DecodingIterator(this, getIndex()); }
public boolean hasNext() { return iter.hasNext() && ! isDelim(iter.peekNext()); }
private void endConstructedElement(long nextElementIndex) throws ASN1Exception { long pos = bi.getIndex(); if (pos < nextElementIndex) { // Any elements in this constructed element that have not yet been read will be discarded int i; for (i = 0; i < (nextElementIndex - pos) && bi.hasNext(); i++) { bi.next(); } if (i != (nextElementIndex - pos)) { throw log.asnUnexpectedEndOfInput(); } } else if (pos > nextElementIndex) { // Shouldn't happen throw new IllegalStateException(); } }
@Override public void skipElement() throws ASN1Exception { readTag(); int length = readLength(); int i; for (i = 0; i < length && bi.hasNext(); i++) { bi.next(); } if (i != length) { throw log.asnUnexpectedEndOfInput(); } }
@Override public boolean decodeBoolean() throws ASN1Exception { readTag(BOOLEAN_TYPE); int length = readLength(); if (length != 1) { throw log.asnInvalidLengthForBooleanTypeTag(); } if (! bi.hasNext()) { throw log.asnUnexpectedEndOfInput(); } return bi.next() != BOOLEAN_FALSE; }
@Override public byte[] decodePrintableStringAsBytes() throws ASN1Exception { readTag(PRINTABLE_STRING_TYPE); final int length = readLength(); int c = 0; byte[] result = new byte[length]; while (bi.hasNext() && c < length) { final int b = bi.next(); validatePrintableByte(b); result[c++] = (byte) b; } if (c < length) { throw log.asnUnexpectedEndOfInput(); } return result; }