This commit is contained in:
RedKale
2016-06-27 09:28:35 +08:00
parent 5593a518fc
commit d3d24529a6

View File

@@ -164,6 +164,7 @@ public final class Utility {
* 获取指定时间当天凌晨零点的格林时间 * 获取指定时间当天凌晨零点的格林时间
* *
* @param time 指定时间 * @param time 指定时间
*
* @return 毫秒数 * @return 毫秒数
*/ */
public static long midnight(long time) { public static long midnight(long time) {
@@ -184,6 +185,7 @@ public final class Utility {
* 获取时间点所在星期的周一 * 获取时间点所在星期的周一
* *
* @param time 指定时间 * @param time 指定时间
*
* @return 毫秒数 * @return 毫秒数
*/ */
public static long monday(long time) { public static long monday(long time) {
@@ -198,6 +200,7 @@ public final class Utility {
* 获取时间点所在星期的周日 * 获取时间点所在星期的周日
* *
* @param time 指定时间 * @param time 指定时间
*
* @return 毫秒数 * @return 毫秒数
*/ */
public static long sunday(long time) { public static long sunday(long time) {
@@ -212,6 +215,7 @@ public final class Utility {
* 获取时间点所在月份的1号 * 获取时间点所在月份的1号
* *
* @param time 指定时间 * @param time 指定时间
*
* @return 毫秒数 * @return 毫秒数
*/ */
public static long monthFirstDay(long time) { public static long monthFirstDay(long time) {
@@ -419,6 +423,7 @@ public final class Utility {
* *
* @param high 高位值 * @param high 高位值
* @param low 低位值 * @param low 低位值
*
* @return long值 * @return long值
*/ */
public static long merge(int high, int low) { public static long merge(int high, int low) {
@@ -495,6 +500,30 @@ public final class Utility {
return remoteHttpContent(ctx, "POST", url, headers, body).toString("UTF-8"); return remoteHttpContent(ctx, "POST", url, headers, body).toString("UTF-8");
} }
public static String postHttpContent(String url, Charset charset) throws IOException {
return remoteHttpContent(null, "POST", url, null, null).toString(charset.name());
}
public static String postHttpContent(String url, Charset charset, String body) throws IOException {
return remoteHttpContent(null, "POST", url, null, body).toString(charset.name());
}
public static String postHttpContent(String url, Charset charset, Map<String, String> headers, String body) throws IOException {
return remoteHttpContent(null, "POST", url, headers, body).toString(charset.name());
}
public static String postHttpContent(SSLContext ctx, String url, Charset charset) throws IOException {
return remoteHttpContent(ctx, "POST", url, null, null).toString(charset.name());
}
public static String postHttpContent(SSLContext ctx, String url, Charset charset, String body) throws IOException {
return remoteHttpContent(ctx, "POST", url, null, body).toString(charset.name());
}
public static String postHttpContent(SSLContext ctx, String url, Charset charset, Map<String, String> headers, String body) throws IOException {
return remoteHttpContent(ctx, "POST", url, headers, body).toString(charset.name());
}
public static byte[] postHttpBytesContent(String url) throws IOException { public static byte[] postHttpBytesContent(String url) throws IOException {
return remoteHttpContent(null, "POST", url, null, null).toByteArray(); return remoteHttpContent(null, "POST", url, null, null).toByteArray();
} }
@@ -527,6 +556,22 @@ public final class Utility {
return remoteHttpContent(null, "GET", url, headers, body).toString("UTF-8"); return remoteHttpContent(null, "GET", url, headers, body).toString("UTF-8");
} }
public static String getHttpContent(String url, Charset charset) throws IOException {
return remoteHttpContent(null, "GET", url, null, null).toString(charset.name());
}
public static String getHttpContent(SSLContext ctx, String url, Charset charset) throws IOException {
return remoteHttpContent(ctx, "GET", url, null, null).toString(charset.name());
}
public static String getHttpContent(SSLContext ctx, String url, Charset charset, Map<String, String> headers, String body) throws IOException {
return remoteHttpContent(ctx, "GET", url, headers, body).toString(charset.name());
}
public static String getHttpContent(String url, Charset charset, Map<String, String> headers, String body) throws IOException {
return remoteHttpContent(null, "GET", url, headers, body).toString(charset.name());
}
public static byte[] getHttpBytesContent(String url) throws IOException { public static byte[] getHttpBytesContent(String url) throws IOException {
return remoteHttpContent(null, "GET", url, null, null).toByteArray(); return remoteHttpContent(null, "GET", url, null, null).toByteArray();
} }