public class Image2Hex {
public static void main(String[] args) {
try{
//存放图片的文件夹
File list = new File("d:/qmx");
File[] lists = list.listFiles();
String name;
//生成的语句存放文件
PrintWriter pw = new PrintWriter(new FileWriter("d:/update.txt"),true);
FileInputStream fis = null;
byte[] b;
for(File file : lists){
//张三.jpg
name=file.getName();
fis = new FileInputStream(file);
b = new byte[fis.available()];
fis.read(b);
pw.println("update sys_userinfo set sign_image =0x" + byte2HexStr(b) + " where realName='" + name.substring(0,name.length() - 4) + "'");
}
pw.flush();
pw.close();
}catch(Exception e){
e.printStackTrace();
}
}
/**
*
* 描述:byte转字符串
*/
public static String byte2HexStr(byte[] b) {
StringBuffer hs = new StringBuffer();
String stmp="";
for (int n=0;n< b.length;n++) {
stmp=(Integer.toHexString(b[n] & 0XFF));
hs.append((stmp.length() == 1 ? "0" : "") + stmp);
}
return hs.toString().toUpperCase();
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有