//java save data as image from image url

public static void image_download(String turl, String fname) throws Exception{
   URL url = new URL(turl);
   InputStream in = new BufferedInputStream(url.openStream());
   ByteArrayOutputStream out = new ByteArrayOutputStream();
   byte[] buf = new byte[1024];
   int n = 0;
   while (-1!=(n=in.read(buf)))
   {
      out.write(buf, 0, n);
   }
  
   out.close();
   in.close();
   byte[] response = out.toByteArray();
  
   FileOutputStream fos;
   fos = new FileOutputStream(fname);
   fos.write(response);
   fos.close();
 }
2015/02/12 16:36 2015/02/12 16:36
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/668

댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/668

트랙백 주소 :: 이 글에는 트랙백을 보낼 수 없습니다

트랙백 RSS :: http://blog.visualp.com/rss/trackback/668

트랙백 ATOM :: http://blog.visualp.com/atom/trackback/668