Top Description Fields Constructors Methods
org.apache.hc.core5.net

public Class URLEncodedUtils

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
java.net.URI, java.nio.charset.Charset, .StandardCharsets, java.util.ArrayList, .Arrays, .BitSet, .List, org.apache.hc.core5.http.NameValuePair, org.apache.hc.core5.http.message.BasicNameValuePair, org.apache.hc.core5.util.Args, .Tokenizer

Deprecated

Use URIBuilder to parse and format URIs and WWWFormCodec to parse and format application/x-www-form-urlencoded forms.

A collection of utilities for encoding URLs.
Since
4.0

Field Summary

Modifier and TypeField and Description
private static final char
private static final char
private static final BitSet

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

An application/x-www-form-urlencoded string
format
(final Iterable<? extends NameValuePair>
The parameters to include.
parameters
,
final char
The parameter separator, by convention, '&' or ';'.
parameterSeparator
,
final Charset
The encoding to use.
charset
)

Returns a String that is suitable for use as an application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST.

public static String

Returns:

An application/x-www-form-urlencoded string
format
(final Iterable<? extends NameValuePair>
The parameters to include.
parameters
,
final Charset
The encoding to use.
charset
)

Returns a String that is suitable for use as an application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST.

public static String

Returns:

URI path component
formatSegments
(final Iterable<String>
the segments.
segments
,
final Charset
parameter charset.
charset
)

Returns a string consisting of joint encoded path segments.

public static String

Returns:

URI path component
formatSegments
(final String...
the segments.
segments
)

Returns a string consisting of joint encoded path segments.

public static List<NameValuePair>

Returns:

list of query parameters.
parse
(final URI
input URI.
uri
,
final Charset
parameter charset.
charset
)

Returns a list of NameValuePairs URI query parameters.

public static List<NameValuePair>

Returns:

list of query parameters.
parse
(final CharSequence
URI query component.
s
,
final Charset
charset to use when decoding the parameters.
charset
)

Returns a list of NameValuePairs URI query parameters.

public static List<NameValuePair>

Returns:

list of query parameters.
parse
(final CharSequence
input text.
s
,
final Charset
parameter charset.
charset
,
final char...
parameter separators.
separators
)

Returns a list of NameValuePairs parameters.

public static List<String>

Returns:

list of segments.
parsePathSegments
(final CharSequence
URI path component.
s
,
final Charset
parameter charset.
charset
)

Returns a list of URI path segments.

public static List<String>

Returns:

list of segments.
parsePathSegments
(final CharSequence
URI path component.
s
)

Returns a list of URI path segments.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

QP_SEP_Aback to summary
private static final char QP_SEP_A
QP_SEP_Sback to summary
private static final char QP_SEP_S
URL_ENCODERback to summary
private static final BitSet URL_ENCODER

Constructor Detail

URLEncodedUtilsback to summary
public URLEncodedUtils()

Method Detail

formatback to summary
public static String format(final Iterable<? extends NameValuePair> parameters, final char parameterSeparator, final Charset charset)

Returns a String that is suitable for use as an application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST.

Parameters
parameters:Iterable<? extends NameValuePair>

The parameters to include.

parameterSeparator:char

The parameter separator, by convention, '&' or ';'.

charset:Charset

The encoding to use.

Returns:String

An application/x-www-form-urlencoded string

Since
4.3
formatback to summary
public static String format(final Iterable<? extends NameValuePair> parameters, final Charset charset)

Returns a String that is suitable for use as an application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST.

Parameters
parameters:Iterable<? extends NameValuePair>

The parameters to include.

charset:Charset

The encoding to use.

Returns:String

An application/x-www-form-urlencoded string

Since
4.2
formatSegmentsback to summary
public static String formatSegments(final Iterable<String> segments, final Charset charset)

Returns a string consisting of joint encoded path segments.

Parameters
segments:Iterable<String>

the segments.

charset:Charset

parameter charset.

Returns:String

URI path component

Since
4.5
formatSegmentsback to summary
public static String formatSegments(final String... segments)

Returns a string consisting of joint encoded path segments.

Parameters
segments:String[]

the segments.

Returns:String

URI path component

Since
4.5
parseback to summary
public static List<NameValuePair> parse(final URI uri, final Charset charset)

Returns a list of NameValuePairs URI query parameters. By convention, '&' and ';' are accepted as parameter separators.

Parameters
uri:URI

input URI.

charset:Charset

parameter charset.

Returns:List<NameValuePair>

list of query parameters.

Since
4.5
parseback to summary
public static List<NameValuePair> parse(final CharSequence s, final Charset charset)

Returns a list of NameValuePairs URI query parameters. By convention, '&' and ';' are accepted as parameter separators.

Parameters
s:CharSequence

URI query component.

charset:Charset

charset to use when decoding the parameters.

Returns:List<NameValuePair>

list of query parameters.

Since
4.2
parseback to summary
public static List<NameValuePair> parse(final CharSequence s, final Charset charset, final char... separators)

Returns a list of NameValuePairs parameters.

Parameters
s:CharSequence

input text.

charset:Charset

parameter charset.

separators:char[]

parameter separators.

Returns:List<NameValuePair>

list of query parameters.

Since
4.4
parsePathSegmentsback to summary
public static List<String> parsePathSegments(final CharSequence s, final Charset charset)

Returns a list of URI path segments.

Parameters
s:CharSequence

URI path component.

charset:Charset

parameter charset.

Returns:List<String>

list of segments.

Since
4.5
parsePathSegmentsback to summary
public static List<String> parsePathSegments(final CharSequence s)

Returns a list of URI path segments.

Parameters
s:CharSequence

URI path component.

Returns:List<String>

list of segments.

Since
4.5