Stores visualization image into the given file.

@param destination file to save image.
543628
public void storeVisualization(File destination) throws IOException {
        final byte[] data = Base64.decodeBase64(getVisualization());
        try (OutputStream stream = new FileOutputStream(destination)) {
            stream.write(data);
        }
    }
249668
public void save(File file) throws IOException {
        BufferedImage bi = new BufferedImage(canvas.getWidth(), canvas.getHeight(), BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2d = bi.createGraphics();
        canvas.print(g2d);

        ImageIO.write(bi, FileChooser.getExtension(file), file);
    }
1007520
public static boolean copy(File source, File destination) {
        boolean result = true;
        if (source.isDirectory()) {
            if (destination.exists()) {
                result = result && destination.isDirectory();
            } else {
                result = result && destination.mkdirs();
            }
            File[] children = source.listFiles();
            for (File element : children) {
                result =
                        result
                                && copy(new File(source, element.getName()),
                                        new File(destination, element.getName()));
            }
            return result;
        } else {
            try {
                InputStream in = new FileInputStream(source);
                OutputStream out = new FileOutputStream(destination);
                result = result && copy(in, out);
                in.close();
                out.close();
                return result;
            } catch (IOException e) {
                return false;
            }
        }
    }
240798
@Override
  public B writeTo(Destination destination) {
    super.writeTo(destination);
    fromState(destination.getProperties());
    return typedSelf();
  }
399425
public static void copyRecursively(Path source, Path destination) throws IOException {
        if (Files.isDirectory(source))
        {
            Files.createDirectories(destination);
            final Set<Path> sources = listFiles(source);

            for (Path srcFile : sources)
            {
                Path destFile = destination.resolve(srcFile.getFileName());
                copyRecursively(srcFile, destFile);
            }
        }
        else
        {
            Files.copy(source, destination, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
        }
    }
310367
public static DestinationUrl createDestinationUrl(String destination) {
        String[] split = splitDestination(destination);
        String host = split[0].trim();
        String jmsDestination = split[1].trim();
        return new DestinationUrl(host, jmsDestination);
    }
374859
static void saveINode2Image(INode node,
                                      DataOutputStream out) throws IOException {
    byte[] name = node.getLocalNameBytes();
    out.writeShort(name.length);
    out.write(name);
    out.writeLong(node.getId());
    
    if (node instanceof INodeHardLinkFile) {
      // Process the hard link file:  
      // If the hard link has more than 1 reference cnt, then store its type with the hard link ID  
      // Otherwise, just store the regular INodeFile's inode type.  
      INodeHardLinkFile hardLink = (INodeHardLinkFile)node; 
      if (hardLink.getHardLinkFileInfo().getReferenceCnt() > 1) {
        out.writeByte(INode.INodeType.HARDLINKED_INODE.type); 
        WritableUtils.writeVLong(out, ((INodeHardLinkFile)node).getHardLinkID()); 
      } else {
        throw new IOException("Invalid reference count for the hardlink file: " +
            node.getFullPathName() + " with the hardlink ID: " + hardLink.getHardLinkID() +
            " and reference cnt: " + hardLink.getHardLinkFileInfo().getReferenceCnt());
      }
    } else if (node instanceof INodeFile && 
        ((INodeFile)node).getStorageType() == StorageType.RAID_STORAGE) {
      INodeFile raidFile = (INodeFile)node;
      INodeRaidStorage storage = (INodeRaidStorage)raidFile.getStorage();
      out.writeByte(INode.INodeType.RAIDED_INODE.type);
      WritableUtils.writeString(out, storage.getCodec().id);
    } else {
      // Process the regular files and directory: just store its inode type 
      out.writeByte(INode.INodeType.REGULAR_INODE.type); 
    }

    FsPermission filePerm = TL_DATA.get().FILE_PERM;
    if (!node.isDirectory()) {  // write file/hardlink inode
      INodeFile fileINode = (INodeFile)node;
      out.writeShort(fileINode.getReplication());
      out.writeLong(fileINode.getModificationTime());
      out.writeLong(fileINode.getAccessTime());
      out.writeLong(fileINode.getPreferredBlockSize());
      writeBlocks(fileINode.getBlocks(), out);
      filePerm.fromShort(fileINode.getFsPermissionShort());
      PermissionStatus.write(out, fileINode.getUserName(),
                             fileINode.getGroupName(),
                             filePerm);
    } else {   // write directory inode
      out.writeShort(0);  // replication
      out.writeLong(node.getModificationTime());
      out.writeLong(0);   // access time
      out.writeLong(0);   // preferred block size
      out.writeInt(-1);    // # of blocks
      out.writeLong(node.getNsQuota());
      out.writeLong(node.getDsQuota());
      filePerm.fromShort(node.getFsPermissionShort());
      PermissionStatus.write(out, node.getUserName(),
                             node.getGroupName(),
                             filePerm);
    }
  }
312156
private boolean copy(InputStream source, String destination) {
        boolean success = true;

        try
        {
            Files.copy(source, Paths.get(destination), StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException ex)
        {
            LOG.fatal("Cannot write file " + destination, ex);
            success = false;
        }

        return success;
    }
1215492
@LogExecTime
	public void verifyImageSource(String locator, String src)
	{
		jtImage.verifyImageSource(locator, src);
	}
1153363
public static void copy(InputStream source, OutputStream destination) throws IOException
    {
        Check.notNull(source);
        Check.notNull(destination);

        final byte[] buffer = new byte[BUFFER_COPY];
        while (true)
        {
            final int read = source.read(buffer);
            if (read == -1)
            {
                break;
            }
            destination.write(buffer, 0, read);
        }
    }
438111
public static void copyFile(File sourceFile, File destinationFile) throws FileNotFoundException, IOException {
		Streams.copyStream(new FileInputStream(sourceFile), new FileOutputStream(destinationFile), true);
	}
1241835
def create_destination(flowable, container, at_top_of_container=False):
    """"""
    vertical_position = 0 if at_top_of_container else container.cursor
    ids = flowable.get_ids(container.document)
    destination = NamedDestination(*(str(id) for id in ids))
    container.canvas.annotate(destination, 0, vertical_position,
                              container.width, None)
    container.document.register_page_reference(container.page, flowable)
854828
private void saveScreenshotTo(final File file) throws IOException {
		byte[] bytes = null;
		try {
			bytes = ((TakesScreenshot) driver)
					.getScreenshotAs(OutputType.BYTES);
		} catch (ClassCastException e) {
			WebDriver augmentedDriver = new Augmenter().augment(driver);
			bytes = ((TakesScreenshot) augmentedDriver)
					.getScreenshotAs(OutputType.BYTES);
		}

		Files.write(bytes, file);
	}
1056176
def save(self, destination: BinaryIO, buffer_size: int=16384) -> None:
        
        close_destination = False
        if isinstance(destination, str):
            destination = open(destination, 'wb')
            close_destination = True
        try:
            copyfileobj(self.stream, destination, buffer_size)
        finally:
            if close_destination:
                destination.close()
334890
def put(self, destination):
        
        if not self._fetched:
            self._fetch()
        DirectoryArchive.put(self, destination)
726441
@Override
    public void setDestinationType(final String destinationType) {
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
            SibTr.debug(this, TRACE, "setDestinationType", destinationType);
        }
        _destinationType = destinationType;
        dynamicallyCreateDestination();
    }
813148
public static void copyResource(String resource, File destination) throws IOException {
        InputStream is = null;
        FileOutputStream fos = null;

        try {
            is = FileUtils.class.getResourceAsStream("/" + resource);
            fos = new FileOutputStream(destination);

            final byte[] buffer = new byte[10 * 1024];
            int len;
            while ((len = is.read(buffer)) > 0) {
                fos.write(buffer, 0, len);
            }
        } finally {
            close(is);
            close(fos);
        }

    }