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 RunTasks calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  66b15724_450e_758d_e9ff_8fb2f09212ec["nextString()"]
  87e46e8d_3da0_7f48_7371_9287ac91a438["nextValue()"]
  87e46e8d_3da0_7f48_7371_9287ac91a438 -->|calls| 66b15724_450e_758d_e9ff_8fb2f09212ec
  9ce2798d_c042_76b3_72c5_e6d6e9d6637d["toString()"]
  66b15724_450e_758d_e9ff_8fb2f09212ec -->|calls| 9ce2798d_c042_76b3_72c5_e6d6e9d6637d
  2ea9368b_02eb_2d26_b6e7_aaf2153de2a0["syntaxError()"]
  66b15724_450e_758d_e9ff_8fb2f09212ec -->|calls| 2ea9368b_02eb_2d26_b6e7_aaf2153de2a0
  f689c599_8725_00e0_186d_a8613721207b["readEscapeCharacter()"]
  66b15724_450e_758d_e9ff_8fb2f09212ec -->|calls| f689c599_8725_00e0_186d_a8613721207b
  style 66b15724_450e_758d_e9ff_8fb2f09212ec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

configuration-metadata/spring-boot-configuration-metadata/src/json-shade/java/org/springframework/boot/configurationmetadata/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