| | |
| | | |
| | | import java.io.*; |
| | | import java.net.FileNameMap; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | |
| | | return type; |
| | | } |
| | | |
| | | public static File httpUrlFile(String netUrl) throws IOException { |
| | | File file = File.createTempFile("temp123", ".xls"); |
| | | InputStream inStream = null; |
| | | FileOutputStream os = null; |
| | | |
| | | try { |
| | | file = File.createTempFile("net_url", ".jpg"); |
| | | URL urlfile = new URL(netUrl); |
| | | inStream = urlfile.openStream(); |
| | | os = new FileOutputStream(file); |
| | | |
| | | byte[] buffer = new byte[8192]; |
| | | |
| | | int bytesRead; |
| | | while((bytesRead = inStream.read(buffer, 0, 8192)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | } catch (Exception var15) { |
| | | var15.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (null != os) { |
| | | os.close(); |
| | | } |
| | | |
| | | if (null != inStream) { |
| | | inStream.close(); |
| | | } |
| | | } catch (Exception var14) { |
| | | var14.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | return file; |
| | | } |
| | | |
| | | } |