APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.javadoc.internal.html

public Class Script

extends Object
Class Inheritance
Imports
java.io.IOException, .Writer

A builder for HTML script elements.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final StringBuilder

Constructor Summary

AccessConstructor and Description
public
Script()

Creates an empty script.

public
Script(String
the code
code
)

Creates a new script containing the specified code.

Method Summary

Modifier and TypeMethod and Description
public Script

Returns:

this object
append
(CharSequence
the code
code
)

Appends the given code to the script.

public Script

Returns:

this object
appendStringLiteral
(CharSequence
the text
text
)

Appends the given text as a string constant to the string.

public Script

Returns:

this object
appendStringLiteral
(CharSequence
the text
text
,
char
the quote character to use
quoteChar
)

Appends the given text as a string constant to the string.

public Content

Returns:

the script
asContent
()

Returns a "live" view of the script as a Content object.

public static String

Returns:

a string literal containing the string
stringLiteral
(CharSequence
the string
s
)

Returns a JavaScript string literal containing a specified string, escaping the characters of that string as needed.

public static String

Returns:

a string literal containing the string
stringLiteral
(CharSequence
the string
s
,
char
the quote character to use for the literal
quoteChar
)

Returns a JavaScript string literal containing a specified string, escaping the characters of that string as needed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sbback to summary
private final StringBuilder sb

Constructor Detail

Scriptback to summary
public Script()

Creates an empty script.

Scriptback to summary
public Script(String code)

Creates a new script containing the specified code.

Parameters
code:String

the code

Method Detail

appendback to summary
public Script append(CharSequence code)

Appends the given code to the script.

Parameters
code:CharSequence

the code

Returns:Script

this object

appendStringLiteralback to summary
public Script appendStringLiteral(CharSequence text)

Appends the given text as a string constant to the string. Characters within the string will be escaped as needed.

Parameters
text:CharSequence

the text

Returns:Script

this object

appendStringLiteralback to summary
public Script appendStringLiteral(CharSequence text, char quoteChar)

Appends the given text as a string constant to the string. Characters within the string will be escaped as needed.

Parameters
text:CharSequence

the text

quoteChar:char

the quote character to use

Returns:Script

this object

asContentback to summary
public Content asContent()

Returns a "live" view of the script as a Content object. Any later modifications to the script will be reflected in the object that is returned.

Returns:Content

the script

stringLiteralback to summary
public static String stringLiteral(CharSequence s)

Returns a JavaScript string literal containing a specified string, escaping the characters of that string as needed.

Parameters
s:CharSequence

the string

Returns:String

a string literal containing the string

stringLiteralback to summary
public static String stringLiteral(CharSequence s, char quoteChar)

Returns a JavaScript string literal containing a specified string, escaping the characters of that string as needed.

Parameters
s:CharSequence

the string

quoteChar:char

the quote character to use for the literal

Returns:String

a string literal containing the string

jdk.javadoc.internal.html back to summary

private Class Script.ScriptContent

extends Content
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final StringBuilder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Script.ScriptContent
add(CharSequence code)

Overrides jdk.javadoc.internal.html.Content.add.

Adds a string content to the existing content.

public boolean
isEmpty()

Implements abstract jdk.javadoc.internal.html.Content.isEmpty.

Returns true if the content is empty.

public boolean
write(Writer writer, String newline, boolean atNewline)

Implements abstract jdk.javadoc.internal.html.Content.write.

Writes content to a writer, using a given newline sequence, which should be either \n or the platform line separator.

Inherited from jdk.javadoc.internal.html.Content:
addaddAllcharCountisDiscardableisPhrasingContentstripTagstoString

Field Detail

sbback to summary
private final StringBuilder sb

Constructor Detail

ScriptContentback to summary
pack-priv ScriptContent(StringBuilder sb)

Method Detail

addback to summary
public Script.ScriptContent add(CharSequence code)

Overrides jdk.javadoc.internal.html.Content.add.

Doc from jdk.javadoc.internal.html.Content.add.

Adds a string content to the existing content. This is an optional operation.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements abstract jdk.javadoc.internal.html.Content.isEmpty.

Doc from jdk.javadoc.internal.html.Content.isEmpty.

Returns true if the content is empty.

Annotations
@Override
writeback to summary
public boolean write(Writer writer, String newline, boolean atNewline) throws IOException

Implements abstract jdk.javadoc.internal.html.Content.write.

Doc from jdk.javadoc.internal.html.Content.write.

Writes content to a writer, using a given newline sequence, which should be either \n or the platform line separator.

Annotations
@Override
Exceptions
IOException:
if an error occurs while writing the output