Package org.jboss.resteasy.util

## Class Encode

- java.lang.Object
- - org.jboss.resteasy.util.Encode

-     public class Encode
      extends Object

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Encode()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static String` | `decode​(String string)` |
    `static javax.ws.rs.core.MultivaluedMap<String,​String>` | `decode​(javax.ws.rs.core.MultivaluedMap<String,​String> map)` | decode an encoded map
    `static javax.ws.rs.core.MultivaluedMap<String,​String>` | `decode​(javax.ws.rs.core.MultivaluedMap<String,​String> map, String charset)` | decode an encoded map
    `static String` | `decodePath​(String path)` |
    `static javax.ws.rs.core.MultivaluedMap<String,​String>` | `encode​(javax.ws.rs.core.MultivaluedMap<String,​String> map)` |
    `static String` | `encodeFragment​(String value)` | Keep encoded values "%..." and template parameters intact.
    `static String` | `encodeFragmentAsIs​(String nameOrValue)` |
    `protected static String` | `encodeFromArray​(String segment, String[] encodingMap, boolean encodePercent)` |
    `static String` | `encodeMatrixParam​(String value)` | Keep encoded values "%..." and template parameters intact.
    `static String` | `encodeNonCodes​(String string)` | Encode '%' if it is not an encoding sequence
    `static String` | `encodePath​(String value)` | Keep encoded values "%...", matrix parameters, template parameters, and '/' characters intact.
    `static String` | `encodePathAsIs​(String segment)` | Encode via RFC 3986.
    `static String` | `encodePathSaveEncodings​(String segment)` | Keep any valid encodings from string i.e.
    `static String` | `encodePathSegment​(String value)` | Keep encoded values "%...", matrix parameters and template parameters intact.
    `static String` | `encodePathSegmentAsIs​(String segment)` | Encode via RFC 3986.
    `static String` | `encodePathSegmentSaveEncodings​(String segment)` | Keep any valid encodings from string i.e.
    `static String` | `encodeQueryParam​(String value)` | Keep encoded values "%..." and template parameters intact.
    `static String` | `encodeQueryParamAsIs​(String nameOrValue)` | Encodes everything of a query parameter name or value.
    `static String` | `encodeQueryParamSaveEncodings​(String segment)` | Keep any valid encodings from string i.e.
    `static String` | `encodeQueryString​(String value)` | Keep encoded values "%..." and template parameters intact.
    `static String` | `encodeString​(String s)` | Calls URLEncoder.encode(s, "UTF-8") on given input.
    `static String` | `encodeValue​(String segment, String[] encoding)` | Keep encoded values "%..." and template parameters intact i.e.
    `static String` | `pathParamReplacement​(String segment, List<String> params)` |
    `static boolean` | `savePathParams​(String segmentString, StringBuilder newSegment, List<String> params)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Encode

          public Encode()

  - ### Method Detail

    - #### encodeQueryString

          public static String encodeQueryString​(String value)

      Keep encoded values "%..." and template parameters intact.
      Parameters:
        `value` - query string
      Returns:
        encoded query string

    - #### encodePath

          public static String encodePath​(String value)

      Keep encoded values "%...", matrix parameters, template parameters, and '/' characters intact.
      Parameters:
        `value` - path
      Returns:
        encoded path

    - #### encodePathSegment

          public static String encodePathSegment​(String value)

      Keep encoded values "%...", matrix parameters and template parameters intact.
      Parameters:
        `value` - path segment
      Returns:
        encoded path segment

    - #### encodeFragment

          public static String encodeFragment​(String value)

      Keep encoded values "%..." and template parameters intact.
      Parameters:
        `value` - uri fragment
      Returns:
        encoded uri fragment

    - #### encodeMatrixParam

          public static String encodeMatrixParam​(String value)

      Keep encoded values "%..." and template parameters intact.
      Parameters:
        `value` - matrix parameter
      Returns:
        encoded matrix parameter

    - #### encodeQueryParam

          public static String encodeQueryParam​(String value)

      Keep encoded values "%..." and template parameters intact.
      Parameters:
        `value` - query parameter
      Returns:
        encoded query parameter

    - #### decodePath

          public static String decodePath​(String path)

    - #### encodeNonCodes

          public static String encodeNonCodes​(String string)

      Encode '%' if it is not an encoding sequence
      Parameters:
        `string` - value to encode
      Returns:
        encoded value

    - #### savePathParams

          public static boolean savePathParams​(String segmentString,
                                               StringBuilder newSegment,
                                               List<String> params)

    - #### encodeValue

          public static String encodeValue​(String segment,
                                           String[] encoding)

      Keep encoded values "%..." and template parameters intact i.e. "{x}"
      Parameters:
        `segment` - value to encode
        `encoding` - encoding
      Returns:
        encoded value

    - #### encodePathAsIs

          public static String encodePathAsIs​(String segment)

      Encode via RFC 3986. PCHAR is allowed allong with '/'

      unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

      Parameters:
        `segment` - value to encode
      Returns:
        encoded value

    - #### encodePathSaveEncodings

          public static String encodePathSaveEncodings​(String segment)

      Keep any valid encodings from string i.e. keep "%2D" but don't keep "%p"
      Parameters:
        `segment` - value to encode
      Returns:
        encoded value

    - #### encodePathSegmentAsIs

          public static String encodePathSegmentAsIs​(String segment)

      Encode via RFC 3986. PCHAR is allowed allong with '/'

      unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

      Parameters:
        `segment` - value to encode
      Returns:
        encoded value

    - #### encodePathSegmentSaveEncodings

          public static String encodePathSegmentSaveEncodings​(String segment)

      Keep any valid encodings from string i.e. keep "%2D" but don't keep "%p"
      Parameters:
        `segment` - value to encode
      Returns:
        encoded value

    - #### encodeQueryParamAsIs

          public static String encodeQueryParamAsIs​(String nameOrValue)

      Encodes everything of a query parameter name or value.
      Parameters:
        `nameOrValue` - value to encode
      Returns:
        encoded value

    - #### encodeQueryParamSaveEncodings

          public static String encodeQueryParamSaveEncodings​(String segment)

      Keep any valid encodings from string i.e. keep "%2D" but don't keep "%p"
      Parameters:
        `segment` - value to encode
      Returns:
        encoded value

    - #### encodeFragmentAsIs

          public static String encodeFragmentAsIs​(String nameOrValue)

    - #### encodeFromArray

          protected static String encodeFromArray​(String segment,
                                                  String[] encodingMap,
                                                  boolean encodePercent)

    - #### encodeString

          public static String encodeString​(String s)

      Calls URLEncoder.encode(s, "UTF-8") on given input.
      Parameters:
        `s` - string to encode
      Returns:
        encoded string returned by URLEncoder.encode(s, "UTF-8")

    - #### pathParamReplacement

          public static String pathParamReplacement​(String segment,
                                                    List<String> params)

    - #### decode

          public static javax.ws.rs.core.MultivaluedMap<String,​String> decode​(javax.ws.rs.core.MultivaluedMap<String,​String> map)

      decode an encoded map
      Parameters:
        `map` - map
      Returns:
        decoded map

    - #### decode

          public static javax.ws.rs.core.MultivaluedMap<String,​String> decode​(javax.ws.rs.core.MultivaluedMap<String,​String> map,
                                                                                    String charset)

      decode an encoded map
      Parameters:
        `map` - map
        `charset` - charset
      Returns:
        decoded map

    - #### encode

          public static javax.ws.rs.core.MultivaluedMap<String,​String> encode​(javax.ws.rs.core.MultivaluedMap<String,​String> map)

    - #### decode

          public static String decode​(String string)