• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
URLEncodedUtils Class Reference

A collection of utilities for encoding URLs. More...

Description

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Static Public Member Functions

static List< NameValuePairparse (final URI uri, final String encoding)
 Returns a list of NameValuePairs as built from the URI's query portion. More...
 
static List< NameValuePairparse (final HttpEntity entity) throws IOException
 Returns a list of NameValuePairs as parsed from an com.good.gd.apache.http.HttpEntity. More...
 
static boolean isEncoded (final HttpEntity entity)
 Returns true if the entity's Content-Type header is application/x-www-form-urlencoded.
 
static void parse (final List< NameValuePair > parameters, final Scanner scanner, final String encoding)
 Adds all parameters within the Scanner to the list of parameters, as encoded by encoding. More...
 
static String format (final List<? extends NameValuePair > parameters, final String encoding)
 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. More...
 

Member Function Documentation

◆ parse() [1/3]

static List<NameValuePair> parse ( final URI  uri,
final String  encoding 
)
static

For example, a URI of http://example.org/path/to/file?a=1&b=2&c=3 would return a list of three NameValuePairs, one for a=1, one for b=2, and one for c=3.

This is typically useful while parsing an HTTP PUT.

Parameters
uriuri to parse
encodingencoding to use while parsing the query

◆ parse() [2/3]

static List<NameValuePair> parse ( final HttpEntity  entity) throws IOException
static

The encoding is taken from the entity's Content-Encoding header.

This is typically used while parsing an HTTP POST.

Parameters
entityThe entity to parse
Exceptions
IOExceptionIf there was an exception getting the entity's data.

◆ parse() [3/3]

static void parse ( final List< NameValuePair parameters,
final Scanner  scanner,
final String  encoding 
)
static

For example, a scanner containing the string a=1&b=2&c=3 would add the NameValuePairs a=1, b=2, and c=3 to the list of parameters.

Parameters
parametersList to add parameters to.
scannerInput that contains the parameters to parse.
encodingEncoding to use when decoding the parameters.

◆ format()

static String format ( final List<? extends NameValuePair parameters,
final String  encoding 
)
static
Parameters
parametersThe parameters to include.
encodingThe encoding to use.