本文整理了Java中org.xipki.util.IoUtil.mkdirsParent()
方法的一些代码示例,展示了IoUtil.mkdirsParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IoUtil.mkdirsParent()
方法的具体详情如下:
包路径:org.xipki.util.IoUtil
类名称:IoUtil
方法名:mkdirsParent
暂无
代码示例来源:origin: xipki/xipki
public static void save(File file, byte[] content) throws IOException {
File tmpFile = expandFilepath(file);
mkdirsParent(tmpFile.toPath());
Files.copy(new ByteArrayInputStream(content), tmpFile.toPath(),
StandardCopyOption.REPLACE_EXISTING);
}
代码示例来源:origin: org.xipki/util
public static void save(File file, byte[] content) throws IOException {
File tmpFile = expandFilepath(file);
mkdirsParent(tmpFile.toPath());
Files.copy(new ByteArrayInputStream(content), tmpFile.toPath(),
StandardCopyOption.REPLACE_EXISTING);
}
代码示例来源:origin: org.xipki/ca-mgmt-client
protected FileOrValue buildFileOrValue(String content, String fileName) throws IOException {
if (content == null) {
return null;
}
Args.notNull(fileName, "fileName");
FileOrValue ret = new FileOrValue();
if (content.length() < 256) {
ret.setValue(content);
return ret;
}
File file = new File(baseDir, fileName);
IoUtil.mkdirsParent(file.toPath());
IoUtil.save(file, content.getBytes("UTF-8"));
ret.setFile(fileName);
return ret;
}
代码示例来源:origin: org.xipki.shell/shell-base
@Override
protected Object execute0() throws Exception {
source = expandFilepath(source);
dest = expandFilepath(dest);
File sourceFile = new File(source);
if (!sourceFile.exists()) {
throw new IllegalCmdParamException(source + " does not exist");
}
if (!sourceFile.isFile()) {
throw new IllegalCmdParamException(source + " is not a file");
}
File destFile = new File(dest);
if (destFile.exists()) {
if (!destFile.isFile()) {
throw new IllegalCmdParamException("cannot override an existing directory by a file");
} else {
if (!force.booleanValue() && !confirm("Do you want to override the file " + dest, 3)) {
return null;
}
}
} else {
IoUtil.mkdirsParent(destFile.toPath());
}
FileUtils.copyFile(sourceFile, destFile, true);
sourceFile.delete();
return null;
}
代码示例来源:origin: org.xipki.shell/shell-base
@Override
protected Object execute0() throws Exception {
source = expandFilepath(source);
dest = expandFilepath(dest);
File sourceFile = new File(source);
if (!sourceFile.exists()) {
throw new IllegalCmdParamException(source + " does not exist");
}
if (!sourceFile.isFile()) {
throw new IllegalCmdParamException(source + " is not a file");
}
File destFile = new File(dest);
if (destFile.exists()) {
if (!destFile.isFile()) {
throw new IllegalCmdParamException("cannot override an existing directory by a file");
} else {
if (!force.booleanValue() && !confirm("Do you want to override the file " + dest, 3)) {
return null;
}
}
} else {
IoUtil.mkdirsParent(destFile.toPath());
}
FileUtils.copyFile(sourceFile, destFile, true);
return null;
}
代码示例来源:origin: org.xipki/ca-mgmt-client
protected FileOrBinary buildFileOrBinary(byte[] content, String fileName) throws IOException {
if (content == null) {
return null;
}
Args.notNull(fileName, "fileName");
FileOrBinary ret = new FileOrBinary();
if (content.length < 256) {
ret.setBinary(content);
return ret;
}
File file = new File(baseDir, fileName);
IoUtil.mkdirsParent(file.toPath());
IoUtil.save(file, content);
ret.setFile(fileName);
return ret;
}
内容来源于网络,如有侵权,请联系作者删除!