本文整理汇总了Java中spark.utils.IOUtils.copy方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java IOUtils.copy怎么用?Java IOUtils.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spark.utils.IOUtils
的用法示例。
在下文中一共展示了IOUtils.copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reloadConfig
import spark.utils.IOUtils; //导入方法依赖的package包/类
private void reloadConfig() throws IOException {
checkConfigDir();
Path configFile = Paths.get(configDir + "/config.conf");
if (Files.notExists(configFile)) {
InputStream defaultConfig = getClass().getResourceAsStream("defaultConfig.conf");
try (FileWriter writer = new FileWriter(configFile.toFile())) {
IOUtils.copy(defaultConfig, writer);
} catch (IOException e) {
e.printStackTrace();
}
}
ConfigurationLoader<CommentedConfigurationNode> loader = HoconConfigurationLoader.builder().setPath(configFile).build();
rootNode = loader.load();
}
开发者ID:UniversalMinecraftAPI,项目名称:UniversalMinecraftAPI,代码行数:20,代码来源:SpongeUniversalMinecraftAPI.java
示例2: reloadUserConfig
import spark.utils.IOUtils; //导入方法依赖的package包/类
private void reloadUserConfig() throws IOException {
checkConfigDir();
Path usersConfigFile = Paths.get(configDir + "/users.conf");
if (Files.notExists(usersConfigFile)) {
InputStream defaultConfig = getClass().getResourceAsStream("defaultUsers.conf");
try (FileWriter writer = new FileWriter(usersConfigFile.toFile())) {
IOUtils.copy(defaultConfig, writer);
} catch (IOException e) {
e.printStackTrace();
}
}
ConfigurationLoader<CommentedConfigurationNode> usersLoader = HoconConfigurationLoader.builder().setPath(usersConfigFile).build();
usersNode = usersLoader.load();
}
开发者ID:UniversalMinecraftAPI,项目名称:UniversalMinecraftAPI,代码行数:20,代码来源:SpongeUniversalMinecraftAPI.java
示例3: doFilter
import spark.utils.IOUtils; //导入方法依赖的package包/类
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws
IOException,
ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request; // NOSONAR
final String relativePath = FilterTools.getRelativePath(httpRequest, filterPath);
if (LOG.isDebugEnabled()) {
LOG.debug(relativePath);
}
HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(httpRequest) {
@Override
public String getRequestURI() {
return relativePath;
}
};
// handle static resources
if (staticResourceHandlers != null) {
for (AbstractResourceHandler staticResourceHandler : staticResourceHandlers) {
AbstractFileResolvingResource resource = staticResourceHandler.getResource(httpRequest);
if (resource != null && resource.isReadable()) {
IOUtils.copy(resource.getInputStream(), response.getWriter());
return;
}
}
}
matcherFilter.doFilter(requestWrapper, response, chain);
}