|
|
|
@ -230,7 +230,18 @@ public class HttpKits {
|
|
|
|
|
* @throws IOException 上传中出现错误则抛出此异常 |
|
|
|
|
*/ |
|
|
|
|
public static void upload(String url, File file) throws IOException { |
|
|
|
|
upload(url, file, StandardCharsets.UTF_8); |
|
|
|
|
upload(url, file, StandardCharsets.UTF_8, HttpRequestType.PUT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 上传文件到指定的服务器 |
|
|
|
|
* |
|
|
|
|
* @param url 接收文件的服务器地址 |
|
|
|
|
* @param file 要上传的文件,默认的文件编码为utf-8 |
|
|
|
|
* @throws IOException 上传中出现错误则抛出此异常 |
|
|
|
|
*/ |
|
|
|
|
public static void upload(String url, File file, HttpRequestType requestType) throws IOException { |
|
|
|
|
upload(url, file, StandardCharsets.UTF_8, requestType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -241,8 +252,8 @@ public class HttpKits {
|
|
|
|
|
* @param charset 文件的编码 |
|
|
|
|
* @throws IOException 上传中出现错误则抛出此异常 |
|
|
|
|
*/ |
|
|
|
|
public static void upload(String url, File file, Charset charset) throws IOException { |
|
|
|
|
upload(url, new FileEntity(file), charset); |
|
|
|
|
public static void upload(String url, File file, Charset charset, HttpRequestType requestType) throws IOException { |
|
|
|
|
upload(url, new FileEntity(file), charset, requestType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -253,8 +264,8 @@ public class HttpKits {
|
|
|
|
|
* @param charset 文件的编码 |
|
|
|
|
* @throws IOException 上传中出现错误则抛出此异常 |
|
|
|
|
*/ |
|
|
|
|
public static void upload(String url, FileEntity fileEntity, Charset charset) throws IOException { |
|
|
|
|
upload(url, fileEntity, charset, Collections.emptyMap(), HttpRequestType.POST); |
|
|
|
|
public static void upload(String url, FileEntity fileEntity, Charset charset, HttpRequestType requestType) throws IOException { |
|
|
|
|
upload(url, fileEntity, charset, Collections.emptyMap(), requestType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|