创建BeanCopier

@param <T> 目标Bean类型
@param source 来源对象，可以是Bean或者Map
@param dest 目标Bean对象
@param copyOptions 拷贝属性选项
@return BeanCopier
516
public static <T> BeanCopier<T> create(Object source, T dest, CopyOptions copyOptions) {
		return create(source, dest, dest.getClass(), copyOptions);
	}
436901
public static void copyBackRouteHeader(byte[] source, byte[] dest) {
        int thisPointCode = getFromSif_DPC(source, 1);
        int remotePointCode = getFromSif_OPC(source, 1);
        int sls = getFromSif_SLS(source, 1);
        int si = getFromSif_SI(source);
        int ssi = getFromSif_SSI(source);
        writeRoutingLabel(dest, si, ssi, sls, remotePointCode, thisPointCode);
    }
1172148
private void internalCopyFile(File src, File dest) throws IORuntimeException {
		if (null != copyFilter && false == copyFilter.accept(src)) {
			//被过滤的文件跳过
			return;
		}
		
		// 如果已经存在目标文件，切为不覆盖模式，跳过之
		if (dest.exists()) {
			if(dest.isDirectory()) {
				//目标为目录，目录下创建同名文件
				dest = new File(dest, src.getName());
			}
			
			if(dest.exists() && false == isOverride) {
				//非覆盖模式跳过
				return;
			}
		}else {
			//路径不存在则创建父目录
			dest.getParentFile().mkdirs();
		}
		
		final ArrayList<CopyOption> optionList = new ArrayList<>(2);
		if(isOverride) {
			optionList.add(StandardCopyOption.REPLACE_EXISTING);
		}
		if(isCopyAttributes) {
			optionList.add(StandardCopyOption.COPY_ATTRIBUTES);
		}
		
		try {
			Files.copy(src.toPath(), dest.toPath(), optionList.toArray(new CopyOption[optionList.size()]));
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
1300314
public static function copyFile(string $source, string $dest)
    {
        $dir = dirname($dest);
        if (!is_dir($dir)) {
            mkdir($dir, 0700, true);
        }
        copy($source, $dest);
    }
805737
public <Dest> Dest copyTo(Object dest, String... excludes) {
		return from(dest)
				.setExchanges(exchangeProps)
				.setExchangeFuncs(exchangeFuncs)
				.setAutoExchange(autoExchange)
				.setExcludePackagePath(excludePackagePath)
				.setTrace(trace)
				.populate(asMap(), excludes).get();
	}
973450
public static void copyStream(final InputStream src, OutputStream dest) throws IOException {
        byte[] buffer = new byte[1024];
        int read;
        while ((read = src.read(buffer)) > -1) {
            dest.write(buffer, 0, read);
        }
        dest.flush();
    }
1277775
public static Object copy(Object src, Object dest, int length) {
		System.arraycopy(src, 0, dest, 0, length);
		return dest;
	}
592693
public static void createFile(final File dest, final InputStream sourceInput) throws IOException {
        if (sourceInput == null || dest == null)
            return;

        FileOutputStream fos = null;
        try {
            if (!dest.getParentFile().exists()) {
                if (!dest.getParentFile().mkdirs()) {
                    throw new FileNotFoundException();
                }
            }
            fos = TextFileOutputStreamFactory.createOutputStream(dest);
            byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];

            int count = -1;
            while ((count = sourceInput.read(buffer)) > 0) {
                fos.write(buffer, 0, count);
            }
            fos.flush();
        } finally {
            Utils.tryToClose(fos);
            Utils.tryToClose(sourceInput);
        }

    }
674838
public static BasicSourceMapConsumer fromSourceMap(SourceMapGenerator aSourceMap) {
        BasicSourceMapConsumer smc = new BasicSourceMapConsumer();

        ArraySet<String> names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
        ArraySet<String> sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
        smc.sourceRoot = aSourceMap._sourceRoot;
        smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
        smc.file = aSourceMap._file;

        // Because we are modifying the entries (by converting string sources and
        // names to indices into the sources and names ArraySets), we have to make
        // a copy of the entry or else bad things happen. Shared mutable state
        // strikes again! See github issue #191.

        List<Mapping> generatedMappings = new ArrayList<>(aSourceMap._mappings.toArray());
        List<ParsedMapping> destGeneratedMappings = smc.__generatedMappings = new ArrayList<>();
        List<ParsedMapping> destOriginalMappings = smc.__originalMappings = new ArrayList<>();

        for (int i = 0, length = generatedMappings.size(); i < length; i++) {
            Mapping srcMapping = generatedMappings.get(i);
            ParsedMapping destMapping = new ParsedMapping();
            destMapping.generatedLine = srcMapping.generated.line;
            destMapping.generatedColumn = srcMapping.generated.column;

            if (srcMapping.source != null) {
                destMapping.source = sources.indexOf(srcMapping.source);
                destMapping.originalLine = srcMapping.original.line;
                destMapping.originalColumn = srcMapping.original.column;
                if (srcMapping.name != null) {
                    destMapping.name = names.indexOf(srcMapping.name);
                }

                destOriginalMappings.add(destMapping);
            }

            destGeneratedMappings.add(destMapping);
        }

        Collections.sort(smc.__originalMappings, Util::compareByOriginalPositions);
        return smc;
    }
548905
function write(destPath, options) {
  var debug = require('../debug').spawn('write');

  debug(function() { return 'destPath'; });
  debug(function() { return destPath; });

  debug(function() { return 'original options';});
  debug(function() { return options; });

  if (options === undefined && typeof destPath !== 'string') {
    options = destPath;
    destPath = undefined;
  }
  options = options || {};

  // set defaults for options if unset
  if (options.includeContent === undefined) {
    options.includeContent = true;
  }
  if (options.addComment === undefined) {
    options.addComment = true;
  }
  if (options.charset === undefined) {
    options.charset = 'utf8';
  }

  debug(function() { return 'derrived options'; });
  debug(function() { return options; });

  var internals = internalsInit(destPath, options);

  function sourceMapWrite(file, encoding, callback) {
    if (file.isNull() || !file.sourceMap) {
      this.push(file);
      return callback();
    }

    if (file.isStream()) {
      return callback(new Error(utils.PLUGIN_NAME + '-write: Streaming not supported'));
    }

    // fix paths if Windows style paths
    file.sourceMap.file = unixStylePath(file.relative);

    internals.setSourceRoot(file);
    internals.loadContent(file);
    internals.mapSources(file);
    internals.mapDestPath(file, this);

    this.push(file);
    callback();
  }

  return through.obj(sourceMapWrite);
}
985915
protected void copyProperties(Object dest, Object source) {
        try {
            BeanUtils.copyProperties(dest, source);
        } catch (Exception e) {
            String errorMessage = MessageFormat.format("M:{0};;E:{1}",
                    e.getCause().getMessage(), e.toString());
            throw new WebApplicationException(errorMessage, Status.BAD_REQUEST);
        }
    }
1186341
public static void copyFile(File src, File dest) throws IOException {

        if (src == null)
            throw new NullPointerException("Source must not be null");
        if (dest == null)
            throw new NullPointerException("Destination must not be null");
        if (!src.exists())
            throw new FileNotFoundException("Source '" + src + "' does not exist");
        if (!src.isFile())
            throw new IOException("Source '" + src + "' is not a file");
        if (dest.exists())
            throw new IOException("Destination '" + dest + "' is already exists");

        FileChannel in = null, out = null;
        try {
            in = new FileInputStream(src).getChannel();
            out = new FileOutputStream(dest).getChannel();

            in.transferTo(0, in.size(), out);
        } finally {
            try {
                in.close();
                out.close();
            } catch (IOException e) {
                // Ignore.
            }
        }

        if (src.length() != dest.length()) {
            throw new IOException("Failed to copy full contents from '" +
                src + "' to '" + dest + "'");
        }

        dest.setLastModified(src.lastModified());
    }
293254
public static void copy(Object src, Object target) throws BeanMappingException {
        BeanCopy copy = BeanCopy.create(src.getClass(), target.getClass());
        copy.copy(src, target);
    }
288265
public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, CopyOptions copyOptions) {
		return fillBeanWithMap(map, bean, false, copyOptions);
	}
968980
public final void copyTo(AbstractCoalescingBufferQueue dest) {
        dest.bufAndListenerPairs.addAll(bufAndListenerPairs);
        dest.incrementReadableBytes(readableBytes);
    }
416463
public static File copyResourceToLocalFile(String sourceResource, String destFileName) throws Exception {
        try {
            Resource keystoreFile = new ClassPathResource(sourceResource);
            InputStream in = keystoreFile.getInputStream();

            File outKeyStoreFile = new File(destFileName);
            FileOutputStream fop = new FileOutputStream(outKeyStoreFile);
            byte[] buf = new byte[512];
            int num;
            while ((num = in.read(buf)) != -1) {
                fop.write(buf, 0, num);
            }
            fop.flush();
            fop.close();
            in.close();
            return outKeyStoreFile;
        } catch (IOException ioe) {
            throw new Exception("Could not copy keystore file: " + ioe.getMessage());
        }
    }
744948
public static void copyAttributes(Map<String, String> source, Element dest) {
        for (Entry<String, String> entry : source.entrySet()) {
            dest.setAttribute(entry.getKey(), entry.getValue());
        }
    }