org.apache.commons.httpclient.methods.multipart.FilePartSource Java Examples

The following examples show how to use org.apache.commons.httpclient.methods.multipart.FilePartSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlipayCore.java    From Shop-for-JavaWeb with MIT License 5 votes vote down vote up
/** 
 * 生成文件摘要
 * @param strFilePath 文件路径
 * @param file_digest_type 摘要算法
 * @return 文件摘要结果
 */
public static String getAbstract(String strFilePath, String file_digest_type) throws IOException {
    PartSource file = new FilePartSource(new File(strFilePath));
	if(file_digest_type.equals("MD5")){
		return DigestUtils.md5Hex(file.createInputStream());
	}
	else if(file_digest_type.equals("SHA")) {
		return DigestUtils.sha256Hex(file.createInputStream());
	}
	else {
		return "";
	}
}
 
Example #2
Source File: AlipayCore.java    From roncoo-pay with Apache License 2.0 5 votes vote down vote up
/**
 * 生成文件摘要
 * @param strFilePath 文件路径
 * @param file_digest_type 摘要算法
 * @return 文件摘要结果
 */
public static String getAbstract(String strFilePath, String file_digest_type) throws IOException {
    PartSource file = new FilePartSource(new File(strFilePath));
	if("MD5".equals(file_digest_type)){
		return DigestUtils.md5Hex(file.createInputStream());
	}
	else if("SHA".equals(file_digest_type)) {
		return DigestUtils.sha256Hex(file.createInputStream());
	}
	else {
		return "";
	}
}
 
Example #3
Source File: AlipayCore.java    From roncoo-pay with Apache License 2.0 5 votes vote down vote up
/** 
 * 生成文件摘要
 * @param strFilePath 文件路径
 * @param file_digest_type 摘要算法
 * @return 文件摘要结果
 */
public static String getAbstract(String strFilePath, String file_digest_type) throws IOException {
    PartSource file = new FilePartSource(new File(strFilePath));
	if(file_digest_type.equals("MD5")){
		return DigestUtils.md5Hex(file.createInputStream());
	}
	else if(file_digest_type.equals("SHA")) {
		return DigestUtils.sha256Hex(file.createInputStream());
	}
	else {
		return "";
	}
}
 
Example #4
Source File: AlipayCore.java    From xmu-2016-MrCode with GNU General Public License v2.0 5 votes vote down vote up
/** 
 * 生成文件摘要
 * @param strFilePath 文件路径
 * @param file_digest_type 摘要算法
 * @return 文件摘要结果
 */
public static String getAbstract(String strFilePath, String file_digest_type) throws IOException {
    PartSource file = new FilePartSource(new File(strFilePath));
	if(file_digest_type.equals("MD5")){
		return DigestUtils.md5Hex(file.createInputStream());
	}
	else if(file_digest_type.equals("SHA")) {
		return DigestUtils.sha256Hex(file.createInputStream());
	}
	else {
		return "";
	}
}
 
Example #5
Source File: AlipayCore.java    From shopping with Apache License 2.0 5 votes vote down vote up
/** 
 * 生成文件摘要
 * @param strFilePath 文件路径
 * @param file_digest_type 摘要算法
 * @return 文件摘要结果
 */
public static String getAbstract(String strFilePath, String file_digest_type) throws IOException {
    PartSource file = new FilePartSource(new File(strFilePath));
	if(file_digest_type.equals("MD5")){
		return DigestUtils.md5Hex(file.createInputStream());
	}
	else if(file_digest_type.equals("SHA")) {
		return DigestUtils.sha256Hex(file.createInputStream());
	}
	else {
		return "";
	}
}