Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws IOException {
- URL url = new URL("http://yandex.st/morda-logo/i/logo.png"
- );
- File f = new File("item.png");
- BufferedInputStream inputStream = new BufferedInputStream(url.openStream());
- byte[] buffer = new byte[30];
- int n;
- FileOutputStream outputStream = new FileOutputStream(f);
- while ((n = inputStream.read(buffer)) >= 0) {
- outputStream.write(buffer, 0, n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement