Saves this image as the specified file. @param file the file to save to @throws IOException if an IO error occurs
(final File file)
| 786 | * @throws IOException if an IO error occurs |
| 787 | */ |
| 788 | public void saveAs(final File file) throws IOException { |
| 789 | downloadImageIfNeeded(); |
| 790 | if (null != imageWebResponse_) { |
| 791 | try (OutputStream fos = Files.newOutputStream(file.toPath()); |
| 792 | InputStream inputStream = imageWebResponse_.getContentAsStream()) { |
| 793 | IOUtils.copy(inputStream, fos); |
| 794 | } |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | /** |
| 799 | * {@inheritDoc} |