Home / Function/ nextString() — spring-boot Function Reference

nextString() — spring-boot Function Reference

Architecture documentation for the nextString() function in JSONTokener.java from the spring-boot codebase.

Function java GradlePlugin AotProcessing calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  a35df52e_f777_54bb_0b5d_4e438a30aff6["nextString()"]
  9d280377_39f9_945d_4b0c_8be3562c4bd5["nextValue()"]
  9d280377_39f9_945d_4b0c_8be3562c4bd5 -->|calls| a35df52e_f777_54bb_0b5d_4e438a30aff6
  4be68463_0335_f913_adab_b9c198431e07["toString()"]
  a35df52e_f777_54bb_0b5d_4e438a30aff6 -->|calls| 4be68463_0335_f913_adab_b9c198431e07
  5d37c1ba_6649_7ef7_7cb2_9bcac45ebb3e["syntaxError()"]
  a35df52e_f777_54bb_0b5d_4e438a30aff6 -->|calls| 5d37c1ba_6649_7ef7_7cb2_9bcac45ebb3e
  456ee97a_fb70_0a4a_5d08_7b1fb0fd3d3d["readEscapeCharacter()"]
  a35df52e_f777_54bb_0b5d_4e438a30aff6 -->|calls| 456ee97a_fb70_0a4a_5d08_7b1fb0fd3d3d
  style a35df52e_f777_54bb_0b5d_4e438a30aff6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/JSONTokener.java lines 187–225

	public String nextString(char quote) throws JSONException {
		/*
		 * For strings that are free of escape sequences, we can just extract the result
		 * as a substring of the input. But if we encounter an escape sequence, we need to
		 * use a StringBuilder to compose the result.
		 */
		StringBuilder builder = null;

		/* the index of the first character not yet appended to the builder. */
		int start = this.pos;

		while (this.pos < this.in.length()) {
			int c = this.in.charAt(this.pos++);
			if (c == quote) {
				if (builder == null) {
					// a new string avoids leaking memory
					return new String(this.in.substring(start, this.pos - 1));
				}
				else {
					builder.append(this.in, start, this.pos - 1);
					return builder.toString();
				}
			}

			if (c == '\\') {
				if (this.pos == this.in.length()) {
					throw syntaxError("Unterminated escape sequence");
				}
				if (builder == null) {
					builder = new StringBuilder();
				}
				builder.append(this.in, start, this.pos - 1);
				builder.append(readEscapeCharacter());
				start = this.pos;
			}
		}

		throw syntaxError("Unterminated string");
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does nextString() do?
nextString() is a function in the spring-boot codebase.
What does nextString() call?
nextString() calls 3 function(s): readEscapeCharacter, syntaxError, toString.
What calls nextString()?
nextString() is called by 1 function(s): nextValue.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free