Advertisement
Guest User

Untitled

a guest
May 5th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import java.io.*;
  2. import java.net.*;
  3.  
  4. public class Renshu11_1 {
  5. public static void main(String[] args) throws Exception {
  6. URL url = new URL("http://dokojava.jp/favicon.ico");
  7. InputStream is = url.openStream();
  8. OutputStream os = new FileOutputStream("dj4.ico");
  9. int data = is.read();
  10. while(data != -1) {
  11. os.write((byte) data);
  12. data = is.read();
  13. }
  14. is.close();
  15. os.flush();
  16. os.close();
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement