public static int getLength(InputStream is) throws IOException {
		int length = 0;
		int nextByte;
		while ((nextByte = is.read()) >= 0 && length < MAX_SUPPORTED_LENGTH) {
			length++;
			if ((nextByte & 0x80) == 0) {
				return length;
			}
		}
		return -1;
	}
Returns the length of the variable length LEB128 value.
 
@param is InputStream to get bytes from
@return length of the LEB128 value, or -1 if the end of the value is not found
@throws IOException if error getting next byte from stream
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/LEB128.java