当前位置: 首页 > news >正文

接私活 做网站德阳做网站公司

接私活 做网站,德阳做网站公司,个旧市哪里有做网站,赣州平面设计公司java缓存读取图片老师布置了任务#xff0c;需要把数据库中的图片一缓存的形式读出#xff0c;不要说什么数据库中路劲#xff0c;图片整体较大#xff0c;在给别人使用时不现实。关键代码#xff1a;for(int i0;i1;i){downloadDB(bi);pm[i]new paintimage(bi);}publi…java缓存读取图片老师布置了任务需要把数据库中的图片一缓存的形式读出不要说什么数据库中路劲图片整体较大在给别人使用时不现实。关键代码for(int i0;i1;i){downloadDB(bi);pm[i]new paintimage(bi);}public void downloadDB(BufferedImage bi){try{/* String sc:\\downloadDB\\i.png;File filenew File(s);FileOutputStream fosnew FileOutputStream(file);*/InputStream innull;String urljdbc:mysql://192.168.**.***:3306/de;Class.forName(com.mysql.jdbc.Driver);Connection conDriverManager.getConnection(url,root,***);String sqlselect * from campusimage;Statement stcon.createStatement();ResultSet rsst.executeQuery(sql);for(int j0;j1;j)rs.next();int m;if(rs.next())inrs.getBinaryStream(1);/*while((min.read())!-1)fos.write(m);*/BufferedInputStream isnew BufferedInputStream(in);biImageIO.read(is);System.out.println(00000000000);rs.close();st.close();con.close();}catch(Exception e){e.printStackTrace();}}class paintimage extends JPanel{//ImageIcon iconnull;Image imanull;paintimage(BufferedImage bi){/*String s1c:\\downloadDB\\i.png;iconnew ImageIcon(s1);imaicon.getImage();*/ima(Image)bi;setBounds(0,0,700,600);System.out.println(1111111111);}public void paint(Graphics g){g.drawImage(ima,0,0,700,600,null);System.out.println(2222222222);}}求指教我会出的是空白图。java缓存图片数据库mysql分享到------解决方案--------------------如果读出来是16进制字符串的话16进制字符串-》byte数组-》流-》文件public class ImgHelper {public static void getImg(String hexString) {byte[] b  ByteHelper.hexStringToBytes(hexString);InputStream is  ByteHelper.byte2Input(b);createFile(is, new File(D://pp.jpg));}//生成图像文件public static void createFile(InputStream is, File targetFile) {BufferedInputStream inBuff  null;BufferedOutputStream outBuff  null;try {// 新建文件输入流并对它进行缓冲inBuff  new BufferedInputStream(is);// 新建文件输出流并对它进行缓冲try {outBuff  new BufferedOutputStream(new FileOutputStream(targetFile));// 缓冲数组byte[] b  new byte[1024 * 5];int len;while ((len  inBuff.read(b)) ! -1) {outBuff.write(b, 0, len);}// 刷新此缓冲的输出流outBuff.flush();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}} finally {// 关闭流try {if (inBuff ! null)inBuff.close();if (outBuff ! null)outBuff.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}public class ByteHelper {public static byte[] hexStringToBytes(String hexString) {if (hexString  null------解决方案--------------------hexString.equals()) {return null;}hexString  hexString.toUpperCase();int length  hexString.length() / 2;char[] hexChars  hexString.toCharArray();byte[] d  new byte[length];for (int i  0; i int pos  i * 2;
http://www.yutouwan.com/news/237736/

相关文章:

  • 医疗器械生产质量管理规范临沂seo公司稳健火星
  • 400网站建设办公网站推广应该注意什么
  • 贵安新区微信网站建设陵水网站建设友创科技
  • 网站建设与运营的市场莒南县建设局网站
  • 济宁做网站大约多少钱标书制作教程全过程
  • 网站建设报价word文档某小型网站开发公司创业策划
  • 网站建设方案机构wordpress菜单导航插件
  • 都有哪些网站谁会网站开发
  • 织梦系统做的网站打开慢做网站最烂公司
  • 一流的网站建设流程图手机浏览器 网站开发
  • 荥阳建设网站网站策划方案
  • 合肥专业做网站公司桂平网络推广
  • 广东深圳网站建设微信商城开发wordpress相册模板
  • 检索标准的网站造作网站模版
  • 设计国外网站有哪些邢台网页美工
  • 化妆品网站设计系统需求的策划书网站有几种类型
  • 网站建设素材库吃什么补肾快
  • 比较好的营销网站推广普通话的顺口溜
  • 网站文章采集工具wordpress 功能插件
  • 浙江省建设工程质监站网站越秀区建设局网站
  • 腾讯云 怎样建设网站wordpress刷赞网站源码
  • 肇庆网站制作系统网站建设流程一般可分为哪几个阶段
  • 可以做网站高仿服装吗做网站需要多长时间才能做好
  • php网站开发流程逻辑logo设计理念万能模板
  • 鹰潭网站设计家教网站开发
  • 怎么做一个局域网站形象类网站
  • 网站平台做捐助功能有风险吗沈阳百度快照优化公司
  • 开县做网站淘宝客建设网站
  • 留言板网站建设总结南通wap网站建设
  • django 网站开发案例wordpress主页透明