日期:2014-05-18 浏览次数:20739 次
public static String getCode(byte[] bs) { ImageIcon icon = new ImageIcon(bs, "hello"); Object ob = JOptionPane.showInputDialog((Component) null, "", "输入验证码", JOptionPane.INFORMATION_MESSAGE, icon, null, ""); return (String) ob; } public static void File() throws Exception { File file = new File("F:\\psp\\picture\\she\\hebe.jpg"); FileInputStream out = new FileInputStream(file); byte[] bs = new byte[out.available()]; out.read(bs); System.out.println(getCode(bs)); }
------解决方案--------------------
保存的word编码与进入保存数据库的编码要做转换。