public String getString(int index) {

		if (stringIndexes.size() == 0 || stringSizes.size() == 0) {
			return null;
		}

		int lastIndex = stringIndexes.get(stringIndexes.size() - 1);
		int lastSize = stringSizes.get(stringSizes.size() - 1);

		if (index < 0 || index >= lastIndex + lastSize) {
			return null;
		}

		int stringLength = 0;
		int stringLengthIndex = Collections.binarySearch(stringIndexes, index);
		if (stringLengthIndex >= 0) {
			stringLength = stringSizes.get(stringLengthIndex);
		}
		else {
			// Reinterpret to the closest offset of a complete string prior
			// to the offset, then get the remainder string length
			stringLengthIndex = (-stringLengthIndex - 1) - 1;
			stringLength =
				stringSizes.get(stringLengthIndex) - (index - stringIndexes.get(stringLengthIndex));
		}

		try {
			// Grab an array of bytes at the index and convert to UTF-8, and don't
			// include the NULL terminator
			return new String(reader.readByteArray(offset + index, stringLength - 1),
				StandardCharsets.UTF_8);
		}
		catch (IOException e) {
			return null;
		}
	}
Gets the string at the given index.

@param index The index of the string to get.
@return The string at the given index.  Could be null if the index was invalid or there was
  a problem reading the string.
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/streams/CliStreamStrings.java