Top Description Inners Fields Constructors Methods
io.r2dbc.spi

pack-priv abstract Class ConnectionUrlParser

extends Object
Class Inheritance
Imports
java.net.URI, .URLDecoder, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, java.util.BitSet, .Set, java.util.function.BiConsumer, java.util.stream.Collectors, .Stream

Parser for R2DBC Connection URL's.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ConnectionUrlParser.Cursor

Parse cursor state.

pack-priv static class
ConnectionUrlParser.QueryStringParser

Parser for RFC3986-style query strings such as key1=value1&key2;=value2.

Field Summary

Modifier and TypeField and Description
private static final Set<String>
private static final String
R2DBC_SCHEME

Scheme for R2DBC.

private static final String
R2DBC_SSL_SCHEME

Scheme for R2DBC with SSL enabled.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static CharSequence

Returns:

the newly decoded CharSequence.
decode
(CharSequence
the CharSequence to decode.
s
)

Simplified fork of URLDecoder.

private static boolean
pack-priv static ConnectionFactoryOptions
pack-priv static void
parseQuery(CharSequence
input text
s
,
BiConsumer<String, String>
consumer notified on tuple creation
tupleConsumer
)

Parse a query string and decode percent encoding according to RFC3986, section 2.4.

private static void
pack-priv static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

PROHIBITED_QUERY_OPTIONSback to summary
private static final Set<String> PROHIBITED_QUERY_OPTIONS
R2DBC_SCHEMEback to summary
private static final String R2DBC_SCHEME

Scheme for R2DBC.

R2DBC_SSL_SCHEMEback to summary
private static final String R2DBC_SSL_SCHEME

Scheme for R2DBC with SSL enabled.

Constructor Detail

ConnectionUrlParserback to summary
private ConnectionUrlParser()

Method Detail

decodeback to summary
private static CharSequence decode(CharSequence s)

Simplified fork of URLDecoder. The supplied encoding is used to determine what characters are represented by any consecutive sequences of the form %xy.

Parameters
s:CharSequence

the CharSequence to decode.

Returns:CharSequence

the newly decoded CharSequence.

See Also
URLDecoder
hasTextback to summary
private static boolean hasText(String s)
parseQueryback to summary
pack-priv static ConnectionFactoryOptions parseQuery(CharSequence url)
parseQueryback to summary
pack-priv static void parseQuery(CharSequence s, BiConsumer<String, String> tupleConsumer)

Parse a query string and decode percent encoding according to RFC3986, section 2.4. Percent-encoded octets are decoded using UTF-8.

Parameters
s:CharSequence

input text

tupleConsumer:BiConsumer<String, String>

consumer notified on tuple creation

See Also
StandardCharsets#UTF_8
parseUserinfoback to summary
private static void parseUserinfo(String s, ConnectionFactoryOptions.Builder builder)
validateback to summary
pack-priv static void validate(String url)
io.r2dbc.spi back to summary

private Class ConnectionUrlParser.Cursor

extends Object
Class Inheritance

Parse cursor state.

Field Summary

Modifier and TypeField and Description
private int
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
Cursor(int upperBound)

Method Summary

Modifier and TypeMethod and Description
pack-priv int
pack-priv int
pack-priv void
pack-priv boolean
pack-priv void
updatePos(final int pos)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

posback to summary
private int pos
upperBoundback to summary
private final int upperBound

Constructor Detail

Cursorback to summary
pack-priv Cursor(int upperBound)

Method Detail

getParsePositionback to summary
pack-priv int getParsePosition()
getUpperBoundback to summary
pack-priv int getUpperBound()
incrementParsePositionback to summary
pack-priv void incrementParsePosition()
isFinishedback to summary
pack-priv boolean isFinished()
updatePosback to summary
pack-priv void updatePos(final int pos)
io.r2dbc.spi back to summary

pack-priv Class ConnectionUrlParser.QueryStringParser

extends Object
Class Inheritance

Parser for RFC3986-style query strings such as key1=value1&key2=value2.

Field Summary

Modifier and TypeField and Description
pack-priv static final char
CR

carriage return (ASCII 13).

private final BitSet
private final CharSequence
pack-priv static final char
LF

line feed (ASCII 10).

pack-priv static final char
SPACE

space (ASCII 32).

private final ConnectionUrlParser.Cursor
pack-priv static final char
TAB

horizontal-tab (ASCII 9).

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
copyContent(StringBuilder
destination buffer
target
)

Transfers content into the destination buffer until a whitespace character or any of the given delimiters is encountered.

pack-priv static ConnectionUrlParser.QueryStringParser

Returns:

a new QueryStringParser instance
create
(CharSequence
must not be null
input
)

Creates a new QueryStringParser given the input.

pack-priv boolean

Returns:

true if parsing is finished; false otherwise
isFinished
()

Returns whether parsing is finished.

private static boolean
isWhitespace(char ch)

pack-priv CharSequence

Returns:

name of the key-value pair
parseName
()

Extracts a sequence of characters identifying the name of the key-value tuple.

private CharSequence
parseToken()

Extracts from the sequence of chars a token terminated with any of the given delimiters discarding semantically insignificant whitespace characters.

pack-priv CharSequence

Returns:

value of the key-value pair, can be null
parseValue
()

Extracts a sequence of characters identifying the name of the key-value tuple.

private void
skipWhiteSpace()

Skips semantically insignificant whitespace characters and moves the cursor to the closest non-whitespace character.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CRback to summary
pack-priv static final char CR

carriage return (ASCII 13).

delimitersback to summary
private final BitSet delimiters
inputback to summary
private final CharSequence input
LFback to summary
pack-priv static final char LF

line feed (ASCII 10).

SPACEback to summary
pack-priv static final char SPACE

space (ASCII 32).

stateback to summary
private final ConnectionUrlParser.Cursor state
TABback to summary
pack-priv static final char TAB

horizontal-tab (ASCII 9).

Constructor Detail

QueryStringParserback to summary
private QueryStringParser(CharSequence input)

Method Detail

copyContentback to summary
private void copyContent(StringBuilder target)

Transfers content into the destination buffer until a whitespace character or any of the given delimiters is encountered.

Parameters
target:StringBuilder

destination buffer

createback to summary
pack-priv static ConnectionUrlParser.QueryStringParser create(CharSequence input)

Creates a new QueryStringParser given the input.

Parameters
input:CharSequence

must not be null

Returns:ConnectionUrlParser.QueryStringParser

a new QueryStringParser instance

isFinishedback to summary
pack-priv boolean isFinished()

Returns whether parsing is finished.

Returns:boolean

true if parsing is finished; false otherwise

isWhitespaceback to summary
private static boolean isWhitespace(char ch)
parseNameback to summary
pack-priv CharSequence parseName()

Extracts a sequence of characters identifying the name of the key-value tuple.

Returns:CharSequence

name of the key-value pair

Exceptions
IllegalStateException:
if parsing is already finished
parseTokenback to summary
private CharSequence parseToken()

Extracts from the sequence of chars a token terminated with any of the given delimiters discarding semantically insignificant whitespace characters.

parseValueback to summary
pack-priv CharSequence parseValue()

Extracts a sequence of characters identifying the name of the key-value tuple.

Returns:CharSequence

value of the key-value pair, can be null

Annotations
@Nullable
Exceptions
IllegalStateException:
if parsing is already finished
skipWhiteSpaceback to summary
private void skipWhiteSpace()

Skips semantically insignificant whitespace characters and moves the cursor to the closest non-whitespace character.