static OfInt parseCsiInts(ByteBuffer csiParam) {
		ByteBuffer buf = csiParam.duplicate();
		return new OfInt() {
			int next = prepareNext();

			private int prepareNext() {
				if (!buf.hasRemaining()) {
					return -1;
				}
				int value = 0;
				while (buf.hasRemaining()) {
					byte b = buf.get();
					if ('0' <= b && b <= '9') {
						value = value * 10 + (b - '0');
					}
					else if (b == ';' || b == ':') {
						return value;
					}
					else {
						throw new UnknownCsiException();
					}
				}
				return value;
			}

			@Override
			public boolean hasNext() {
				return next != -1;
			}

			@Override
			public int nextInt() {
				int ret = next;
				next = prepareNext();
				return ret;
			}
		};
	}
Parse a sequence of integers in the form {@code <em>n</em> ; <em>m</em> ;} ....

<p>
This is designed to replace the {@link String#split(String)} and
{@link Integer#parseInt(String)} pattern, which should avoid some unnecessary object
creation. Unfortunately, the iterator itself is still an object.... Each parameter is parsed
on demand.

@param csiParam the buffer of characters containing the parameters to parse
@return an iterator of integers
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/vt/VtHandler.java