From 81ab8dd81cb87010cf480894d3343504fab3a0e6 Mon Sep 17 00:00:00 2001 From: Allen Date: Wed, 17 Apr 2019 10:39:36 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E6=96=B9=E6=B3=95=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/hotlcc/wechat4j/Wechat.java | 16 ++++++++-------- .../java/com/hotlcc/wechat4j/util/FileUtil.java | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/hotlcc/wechat4j/Wechat.java b/src/main/java/com/hotlcc/wechat4j/Wechat.java index 05079d5..7dd7fff 100644 --- a/src/main/java/com/hotlcc/wechat4j/Wechat.java +++ b/src/main/java/com/hotlcc/wechat4j/Wechat.java @@ -1296,7 +1296,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendImage(String userName, File image) { - ContentType contentType = FileUtil.getContentBody(image); + ContentType contentType = FileUtil.getContentType(image); byte[] mediaData = FileUtil.getBytes(image); return sendImage(userName, mediaData, image.getName(), contentType); } @@ -1336,7 +1336,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendImageToNickName(String nickName, File image) { - ContentType contentType = FileUtil.getContentBody(image); + ContentType contentType = FileUtil.getContentType(image); byte[] mediaData = FileUtil.getBytes(image); return sendImageToNickName(nickName, mediaData, image.getName(), contentType); } @@ -1376,7 +1376,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendImageToRemarkName(String remarkName, File image) { - ContentType contentType = FileUtil.getContentBody(image); + ContentType contentType = FileUtil.getContentType(image); byte[] mediaData = FileUtil.getBytes(image); return sendImageToRemarkName(remarkName, mediaData, image.getName(), contentType); } @@ -1427,7 +1427,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendImage(String userName, String nickName, String remarkName, File image) { - ContentType contentType = FileUtil.getContentBody(image); + ContentType contentType = FileUtil.getContentType(image); byte[] mediaData = FileUtil.getBytes(image); return sendImage(userName, nickName, remarkName, mediaData, image.getName(), contentType); } @@ -1489,7 +1489,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendVideo(String userName, File video) { - ContentType contentType = FileUtil.getContentBody(video); + ContentType contentType = FileUtil.getContentType(video); byte[] mediaData = FileUtil.getBytes(video); return sendVideo(userName, mediaData, video.getName(), contentType); } @@ -1529,7 +1529,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendVideoToNickName(String nickName, File video) { - ContentType contentType = FileUtil.getContentBody(video); + ContentType contentType = FileUtil.getContentType(video); byte[] mediaData = FileUtil.getBytes(video); return sendVideoToNickName(nickName, mediaData, video.getName(), contentType); } @@ -1569,7 +1569,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendVideoToRemarkName(String remarkName, File video) { - ContentType contentType = FileUtil.getContentBody(video); + ContentType contentType = FileUtil.getContentType(video); byte[] mediaData = FileUtil.getBytes(video); return sendVideoToRemarkName(remarkName, mediaData, video.getName(), contentType); } @@ -1619,7 +1619,7 @@ public class Wechat { * @return 返回数据 */ public JSONObject sendVideo(String userName, String nickName, String remarkName, File video) { - ContentType contentType = FileUtil.getContentBody(video); + ContentType contentType = FileUtil.getContentType(video); byte[] mediaData = FileUtil.getBytes(video); return sendVideo(userName, nickName, remarkName, mediaData, video.getName(), contentType); } diff --git a/src/main/java/com/hotlcc/wechat4j/util/FileUtil.java b/src/main/java/com/hotlcc/wechat4j/util/FileUtil.java index eb1c194..aad54aa 100644 --- a/src/main/java/com/hotlcc/wechat4j/util/FileUtil.java +++ b/src/main/java/com/hotlcc/wechat4j/util/FileUtil.java @@ -74,7 +74,7 @@ public final class FileUtil { * @param file 文件 * @return ContentType */ - public static ContentType getContentBody(File file) { + public static ContentType getContentType(File file) { String mimeType = new MimetypesFileTypeMap().getContentType(file); ContentType contentType = ContentType.parse(mimeType); return contentType;