org.apache.commons.httpclient.util
Class URIUtil.Coder

java.lang.Object
  |
  +--org.apache.commons.httpclient.URI
        |
        +--org.apache.commons.httpclient.util.URIUtil.Coder
All Implemented Interfaces:
Cloneable, Comparable, Serializable
Enclosing class:
URIUtil

protected static class URIUtil.Coder
extends URI

The basic and internal utility for URI escape and character encoding and decoding.

See Also:
Serialized Form

Inner classes inherited from class org.apache.commons.httpclient.URI
URI.DefaultCharsetChanged, URI.LocaleToCharsetMap
 
Fields inherited from class org.apache.commons.httpclient.URI
_authority, _fragment, _host, _is_abs_path, _is_hier_part, _is_hostname, _is_IPv4address, _is_IPv6reference, _is_net_path, _is_opaque_part, _is_reg_name, _is_rel_path, _is_server, _opaque, _path, _port, _query, _scheme, _uri, _userinfo, abs_path, absoluteURI, allowed_abs_path, allowed_authority, allowed_fragment, allowed_host, allowed_IPv6reference, allowed_opaque_part, allowed_query, allowed_reg_name, allowed_rel_path, allowed_userinfo, allowed_within_authority, allowed_within_path, allowed_within_query, allowed_within_userinfo, alpha, alphanum, authority, control, defaultDocumentCharset, defaultDocumentCharsetByLocale, defaultDocumentCharsetByPlatform, defaultProtocolCharset, delims, digit, disallowed_opaque_part, disallowed_rel_path, domainlabel, escaped, fragment, hash, hex, hier_part, host, hostname, hostport, IPv4address, IPv6address, IPv6reference, mark, net_path, opaque_part, param, path, path_segments, pchar, percent, port, protocolCharset, query, reg_name, rel_path, rel_segment, relativeURI, reserved, rootPath, scheme, segment, serialVersionUID, server, space, toplabel, unreserved, unwise, URI_reference, uric, uric_no_slash, userinfo, within_userinfo
 
Constructor Summary
protected URIUtil.Coder()
           
 
Method Summary
static String decode(char[] escapedComponent, String charset)
          Unescape and decode a given string.
static char[] encode(String unescapedComponent, BitSet allowed, String charset)
          Escape and encode a given string with allowed characters not to be escaped.
static String replace(String original, char[] from, char[] to)
          Replace from a given character to given character in an array order for a given string.
static String replace(String original, char from, char to)
          Replace from a given character to given character for a given string.
static boolean verifyEscaped(char[] original)
          Verify whether a given string is escaped or not
 
Methods inherited from class org.apache.commons.httpclient.URI
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , clone, compareTo, equals, equals, getAboveHierPath, getAuthority, getCurrentHierPath, getDefaultDocumentCharset, getDefaultDocumentCharsetByLocale, getDefaultDocumentCharsetByPlatform, getDefaultProtocolCharset, getEscapedAboveHierPath, getEscapedAuthority, getEscapedCurrentHierPath, getEscapedFragment, getEscapedName, getEscapedPath, getEscapedPathQuery, getEscapedQuery, getEscapedURI, getEscapedURIReference, getEscapedUserinfo, getFragment, getHost, getName, getPath, getPathQuery, getPort, getProtocolCharset, getQuery, getRawAboveHierPath, getRawAuthority, getRawCurrentHierPath, getRawCurrentHierPath, getRawFragment, getRawHost, getRawName, getRawPath, getRawPathQuery, getRawQuery, getRawScheme, getRawURI, getRawURIReference, getRawUserinfo, getScheme, getURI, getURIReference, getUserinfo, hasAuthority, hasFragment, hashCode, hasQuery, hasUserinfo, indexFirstOf, indexFirstOf, indexFirstOf, indexFirstOf, isAbsoluteURI, isAbsPath, isHierPart, isHostname, isIPv4address, isIPv6reference, isNetPath, isOpaquePart, isRegName, isRelativeURI, isRelPath, isServer, normalize, normalize, parseAuthority, parseUriReference, prevalidate, readObject, removeFragmentIdentifier, resolvePath, setDefaultDocumentCharset, setDefaultProtocolCharset, setEscapedAuthority, setEscapedFragment, setEscapedPath, setEscapedQuery, setFragment, setPath, setQuery, setRawAuthority, setRawFragment, setRawPath, setRawQuery, setURI, toString, validate, validate, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URIUtil.Coder

protected URIUtil.Coder()
Method Detail

encode

public static char[] encode(String unescapedComponent,
                            BitSet allowed,
                            String charset)
                     throws URIException
Escape and encode a given string with allowed characters not to be escaped.
Parameters:
unescapedComponent - an unescaped component
allowed - allowed characters not to be escaped
charset - the charset to encode
Returns:
the escaped and encoded string
Throws:
URIException - if the charset is not supported

decode

public static String decode(char[] escapedComponent,
                            String charset)
                     throws URIException
Unescape and decode a given string.
Parameters:
escapedComponent - an being-unescaped component
charset - the charset to decode
Returns:
the escaped and encoded string
Throws:
URIException - if the charset is not supported

verifyEscaped

public static boolean verifyEscaped(char[] original)
Verify whether a given string is escaped or not
Parameters:
original - given characters
Returns:
true if the given character array is 7 bit ASCII-compatible.

replace

public static String replace(String original,
                             char[] from,
                             char[] to)
Replace from a given character to given character in an array order for a given string.
Parameters:
original - a given string
from - a replacing character array
to - a replaced character array
Returns:
the replaced string

replace

public static String replace(String original,
                             char from,
                             char to)
Replace from a given character to given character for a given string.
Parameters:
original - a given string
from - a replacing character array
to - a replaced character array
Returns:
the replaced string


Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.