parse ( )源码实例Demo

java.util.Date#parse ( )源码实例Demo

下面列出了java.util.Date#parse ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Jose4j   文件: HttpsJwks.java
static long getDateHeaderValue(SimpleResponse response, String headerName, long defaultValue)
{
    List<String> values = getHeaderValues(response, headerName);
    for (String value : values)
    {
        try
        {
            if (!value.endsWith("GMT"))
            {
                value += " GMT";
            }

            return Date.parse(value);
        }
        catch (Exception e)
        {
            // ignore it
        }
    }
    return defaultValue;
}
 
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码3 项目: dragonwell8_jdk   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码4 项目: jdk8u-jdk   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码5 项目: jdk8u_jdk   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码6 项目: jdk8u60   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码7 项目: jdk8u-dev-jdk   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码8 项目: j2objc   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码10 项目: hottub   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码11 项目: Bytecoder   文件: HttpURLConnection.java
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String dateString = getHeaderField(name);
    try {
        if (dateString.indexOf("GMT") == -1) {
            dateString = dateString+" GMT";
        }
        return Date.parse(dateString);
    } catch (Exception e) {
    }
    return Default;
}
 
源代码12 项目: quantumdb   文件: TableDataMigrator.java
private Object parseValue(Type type, String value) {
	if (Strings.isNullOrEmpty(value)) {
		return null;
	}

	switch (type) {
		case SMALLINT:
		case INTEGER:
			return Integer.parseInt(value);
		case BIGINT:
			return Long.parseLong(value);
		case BOOLEAN:
			return Boolean.parseBoolean(value);
		case TEXT:
		case CHAR:
		case VARCHAR:
			return value;
		case DATE:
			return Date.parse(value);
		case FLOAT:
			return Float.parseFloat(value);
		case TIMESTAMP:
			return Timestamp.parse(value);
		case OID:
			return value;
		case UUID:
		default:
			return UUID.fromString(value);
	}
}
 
源代码13 项目: commcare-android   文件: DotsData.java
public static DotsData DeserializeDotsData(String dots) {

        try {
            JSONObject data = new JSONObject(new JSONTokener(dots));

            Date anchor = new Date(Date.parse(data.getString("anchor")));

            JSONArray jRegs = data.getJSONArray("regimens");
            int[] regs = new int[jRegs.length()];
            for (int i = 0; i < regs.length; ++i) {
                regs[i] = jRegs.getInt(i);
            }

            int[][] regLabels = new int[regs.length][];
            if (data.has("regimen_labels")) {
                JSONArray jRegLabels = data.getJSONArray("regimen_labels");
                if (jRegLabels.length() != regs.length) {
                    //TODO: specific exception type here
                    throw new RuntimeException("Invalid DOTS model! Regimens and Labels are incompatible lengths");
                }
                for (int i = 0; i < jRegLabels.length(); ++i) {
                    JSONArray jLabels = jRegLabels.getJSONArray(i);
                    regLabels[i] = new int[jLabels.length()];
                    for (int j = 0; j < jLabels.length(); ++j) {
                        regLabels[i][j] = jLabels.getInt(j);
                    }
                }
            } else {
                //No default regimen labels
                regLabels = null;
            }

            JSONArray jDays = data.getJSONArray("days");
            DotsDay[] days = new DotsDay[jDays.length()];
            for (int i = 0; i < days.length; ++i) {
                days[i] = DotsDay.deserialize(jDays.getJSONArray(i));
            }

            return new DotsData(anchor, regs, days, regLabels);
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }


    }
 
源代码14 项目: jdk1.8-source-analysis   文件: URLConnection.java
/**
 * Returns the value of the named field parsed as date.
 * The result is the number of milliseconds since January 1, 1970 GMT
 * represented by the named field.
 * <p>
 * This form of {@code getHeaderField} exists because some
 * connection types (e.g., {@code http-ng}) have pre-parsed
 * headers. Classes for that connection type can override this method
 * and short-circuit the parsing.
 *
 * @param   name     the name of the header field.
 * @param   Default   a default value.
 * @return  the value of the field, parsed as a date. The value of the
 *          {@code Default} argument is returned if the field is
 *          missing or malformed.
 */
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String value = getHeaderField(name);
    try {
        return Date.parse(value);
    } catch (Exception e) { }
    return Default;
}
 
源代码15 项目: dragonwell8_jdk   文件: URLConnection.java
/**
 * Returns the value of the named field parsed as date.
 * The result is the number of milliseconds since January 1, 1970 GMT
 * represented by the named field.
 * <p>
 * This form of {@code getHeaderField} exists because some
 * connection types (e.g., {@code http-ng}) have pre-parsed
 * headers. Classes for that connection type can override this method
 * and short-circuit the parsing.
 *
 * @param   name     the name of the header field.
 * @param   Default   a default value.
 * @return  the value of the field, parsed as a date. The value of the
 *          {@code Default} argument is returned if the field is
 *          missing or malformed.
 */
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String value = getHeaderField(name);
    try {
        return Date.parse(value);
    } catch (Exception e) { }
    return Default;
}
 
源代码16 项目: TencentKona-8   文件: URLConnection.java
/**
 * Returns the value of the named field parsed as date.
 * The result is the number of milliseconds since January 1, 1970 GMT
 * represented by the named field.
 * <p>
 * This form of {@code getHeaderField} exists because some
 * connection types (e.g., {@code http-ng}) have pre-parsed
 * headers. Classes for that connection type can override this method
 * and short-circuit the parsing.
 *
 * @param   name     the name of the header field.
 * @param   Default   a default value.
 * @return  the value of the field, parsed as a date. The value of the
 *          {@code Default} argument is returned if the field is
 *          missing or malformed.
 */
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String value = getHeaderField(name);
    try {
        return Date.parse(value);
    } catch (Exception e) { }
    return Default;
}
 
源代码17 项目: openjdk-jdk8u   文件: URLConnection.java
/**
 * Returns the value of the named field parsed as date.
 * The result is the number of milliseconds since January 1, 1970 GMT
 * represented by the named field.
 * <p>
 * This form of {@code getHeaderField} exists because some
 * connection types (e.g., {@code http-ng}) have pre-parsed
 * headers. Classes for that connection type can override this method
 * and short-circuit the parsing.
 *
 * @param   name     the name of the header field.
 * @param   Default   a default value.
 * @return  the value of the field, parsed as a date. The value of the
 *          {@code Default} argument is returned if the field is
 *          missing or malformed.
 */
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String value = getHeaderField(name);
    try {
        return Date.parse(value);
    } catch (Exception e) { }
    return Default;
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: URLConnection.java
/**
 * Returns the value of the named field parsed as date.
 * The result is the number of milliseconds since January 1, 1970 GMT
 * represented by the named field.
 * <p>
 * This form of {@code getHeaderField} exists because some
 * connection types (e.g., {@code http-ng}) have pre-parsed
 * headers. Classes for that connection type can override this method
 * and short-circuit the parsing.
 *
 * @param   name     the name of the header field.
 * @param   Default   a default value.
 * @return  the value of the field, parsed as a date. The value of the
 *          {@code Default} argument is returned if the field is
 *          missing or malformed.
 */
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String value = getHeaderField(name);
    try {
        return Date.parse(value);
    } catch (Exception e) { }
    return Default;
}
 
源代码19 项目: openjdk-jdk9   文件: URLConnection.java
/**
 * Returns the value of the named field parsed as date.
 * The result is the number of milliseconds since January 1, 1970 GMT
 * represented by the named field.
 * <p>
 * This form of {@code getHeaderField} exists because some
 * connection types (e.g., {@code http-ng}) have pre-parsed
 * headers. Classes for that connection type can override this method
 * and short-circuit the parsing.
 *
 * @param   name     the name of the header field.
 * @param   Default   a default value.
 * @return  the value of the field, parsed as a date. The value of the
 *          {@code Default} argument is returned if the field is
 *          missing or malformed.
 */
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) {
    String value = getHeaderField(name);
    try {
        return Date.parse(value);
    } catch (Exception e) { }
    return Default;
}
 
源代码20 项目: jdk-1.7-annotated   文件: URLConnection.java
/**
 * Returns the value of the named field parsed as date.
 * The result is the number of milliseconds since January 1, 1970 GMT
 * represented by the named field.
 * <p>
 * This form of <code>getHeaderField</code> exists because some
 * connection types (e.g., <code>http-ng</code>) have pre-parsed
 * headers. Classes for that connection type can override this method
 * and short-circuit the parsing.
 *
 * @param   name     the name of the header field.
 * @param   Default   a default value.
 * @return  the value of the field, parsed as a date. The value of the
 *          <code>Default</code> argument is returned if the field is
 *          missing or malformed.
 */
public long getHeaderFieldDate(String name, long Default) {
    String value = getHeaderField(name);
    try {
        return Date.parse(value);
    } catch (Exception e) { }
    return Default;
}