yt4droid.internal.org.json
クラス Cookie

java.lang.Object
  上位を拡張 yt4droid.internal.org.json.Cookie

public class Cookie
extends java.lang.Object

Convert a web browser cookie specification to a JSONObject and back. JSON and Cookies are both notations for name/value pairs.

バージョン:
2010-12-24
作成者:
JSON.org

コンストラクタの概要
Cookie()
           
 
メソッドの概要
static java.lang.String escape(java.lang.String string)
          Produce a copy of a string in which the characters '+', '%', '=', ';' and control characters are replaced with "%hh".
static JSONObject toJSONObject(java.lang.String string)
          Convert a cookie specification string into a JSONObject.
static java.lang.String toString(JSONObject jo)
          Convert a JSONObject into a cookie specification string.
static java.lang.String unescape(java.lang.String string)
          Convert %hh sequences to single characters, and convert plus to space.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

Cookie

public Cookie()
メソッドの詳細

escape

public static java.lang.String escape(java.lang.String string)
Produce a copy of a string in which the characters '+', '%', '=', ';' and control characters are replaced with "%hh". This is a gentle form of URL encoding, attempting to cause as little distortion to the string as possible. The characters '=' and ';' are meta characters in cookies. By convention, they are escaped using the URL-encoding. This is only a convention, not a standard. Often, cookies are expected to have encoded values. We encode '=' and ';' because we must. We encode '%' and '+' because they are meta characters in URL encoding.

パラメータ:
string - The source string.
戻り値:
The escaped result.

toJSONObject

public static JSONObject toJSONObject(java.lang.String string)
                               throws JSONException
Convert a cookie specification string into a JSONObject. The string will contain a name value pair separated by '='. The name and the value will be unescaped, possibly converting '+' and '%' sequences. The cookie properties may follow, separated by ';', also represented as name=value (except the secure property, which does not have a value). The name will be stored under the key "name", and the value will be stored under the key "value". This method does not do checking or validation of the parameters. It only converts the cookie string into a JSONObject.

パラメータ:
string - The cookie specification string.
戻り値:
A JSONObject containing "name", "value", and possibly other members.
例外:
JSONException

toString

public static java.lang.String toString(JSONObject jo)
                                 throws JSONException
Convert a JSONObject into a cookie specification string. The JSONObject must contain "name" and "value" members. If the JSONObject contains "expires", "domain", "path", or "secure" members, they will be appended to the cookie specification string. All other members are ignored.

パラメータ:
jo - A JSONObject
戻り値:
A cookie specification string
例外:
JSONException

unescape

public static java.lang.String unescape(java.lang.String string)
Convert %hh sequences to single characters, and convert plus to space.

パラメータ:
string - A string that may contain + (plus) and %hh sequences.
戻り値:
The unescaped string.