本文整理了Java中org.geoserver.util.IOUtils.deepCopy()
方法的一些代码示例,展示了IOUtils.deepCopy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.deepCopy()
方法的具体详情如下:
包路径:org.geoserver.util.IOUtils
类名称:IOUtils
方法名:deepCopy
[英]Copy the contents of fromDir into toDir (if the latter is missing it will be created)
[中]将fromDir的内容复制到toDir中(如果缺少后者,将创建该内容)
代码示例来源:origin: geoserver/geoserver
/**
* Copy the contents of fromDir into toDir (if the latter is missing it will be created)
*
* @param fromDir
* @param toDir
* @throws IOException
*/
public static void deepCopy(File fromDir, File toDir) throws IOException {
if (!fromDir.isDirectory() || !fromDir.exists())
throw new IllegalArgumentException(
"Invalid source directory "
+ "(it's either not a directory, or does not exist");
if (toDir.exists() && toDir.isFile())
throw new IllegalArgumentException(
"Invalid destination directory, " + "it happens to be a file instead");
// create destination if not available
if (!toDir.exists()) if (!toDir.mkdir()) throw new IOException("Could not create " + toDir);
File[] files = fromDir.listFiles();
for (File file : files) {
File destination = new File(toDir, file.getName());
if (file.isDirectory()) deepCopy(file, destination);
else copy(file, destination);
}
}
代码示例来源:origin: geoserver/geoserver
@Override
public void setUp() throws Exception {
data = IOUtils.createRandomDirectory("./target", "live", "data");
IOUtils.deepCopy(source, data);
}
代码示例来源:origin: geoserver/geoserver
/**
* Deeps copy the dataDirSourceDirectory provided in the constructor into a temporary directory.
* Subclasses may override it in order to add extra behavior (like setting up an external
* database)
*/
public void setUp() throws Exception {
data = IOUtils.createRandomDirectory("./target", "live", "data");
IOUtils.deepCopy(source, data);
}
代码示例来源:origin: org.geoserver.security/gs-sec-jdbc
@Override
public void setUp() throws Exception {
data = IOUtils.createRandomDirectory("./target", "live", "data");
IOUtils.deepCopy(source, data);
}
代码示例来源:origin: org.geoserver.community/gs-jms-geoserver
public GeoServerInstance(String instanceName) {
try {
// create this instance base data directory by copying the base test data
dataDirectory = createTempDirectory(instanceName == null ? "INSTANCE" : instanceName);
IOUtils.deepCopy(BASE_TEST_DATA.getDataDirectoryRoot(), dataDirectory);
// disable security manager to speed up tests
System.setSecurityManager(null);
// take control of the logging
Logging.ALL.setLoggerFactory(Log4JLoggerFactory.getInstance());
System.setProperty(LoggingUtils.RELINQUISH_LOG4J_CONTROL, "true");
// initialize Spring application context
applicationContext = initInstance();
// get some JMS util beans
jmsController = applicationContext.getBean(Controller.class);
jmsQueueListener = applicationContext.getBean(JMSQueueListener.class);
// set integration tests cluster name
jmsController.setGroup(CLUSTER_NAME);
saveJmsConfiguration();
} catch (Exception exception) {
throw new RuntimeException(
String.format("Error instantiating GeoServer instance '%s'.", instanceName),
exception);
}
}
内容来源于网络,如有侵权,请联系作者删除!