本文整理了Java中hudson.Util.changeExtension()
方法的一些代码示例,展示了Util.changeExtension()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.changeExtension()
方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:changeExtension
[英]Returns a file name by changing its extension.
[中]通过更改扩展名返回文件名。
代码示例来源:origin: jenkinsci/jenkins
/**
* Called when the download is completed to overwrite
* the old file with the new file.
*/
protected void replace(File dst, File src) throws IOException {
File bak = Util.changeExtension(dst,".bak");
bak.delete();
dst.renameTo(bak);
dst.delete(); // any failure up to here is no big deal
if(!src.renameTo(dst)) {
throw new IOException("Failed to rename "+src+" to "+dst);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Called when the download is completed to overwrite
* the old file with the new file.
*/
@Override
protected void replace(File dst, File src) throws IOException {
if (!site.getId().equals(ID_UPLOAD)) {
verifyChecksums(this, plugin, src);
}
File bak = Util.changeExtension(dst, ".bak");
bak.delete();
final File legacy = getLegacyDestination();
if (legacy.exists()) {
if (!legacy.renameTo(bak)) {
legacy.delete();
}
}
if (dst.exists()) {
if (!dst.renameTo(bak)) {
dst.delete();
}
}
if(!src.renameTo(dst)) {
throw new IOException("Failed to rename "+src+" to "+dst);
}
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public void downgade() throws IOException {
File backupFile = Util.changeExtension(hpiArchive, ".bak");
if (backupFile.exists()) {
hpiArchive.delete();
}
if (!backupFile.renameTo(hpiArchive)) {
throw new IOException("Failed to rename " + backupFile + " to " + hpiArchive);
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Called when the download is completed to overwrite the old file with
* the new file.
*/
protected void replace(File dst, File src) throws IOException {
File bak = Util.changeExtension(dst, ".bak");
bak.delete();
dst.renameTo(bak);
dst.delete(); // any failure up to here is no big deal
if (!src.renameTo(dst)) {
throw new IOException("Failed to rename " + src + " to " + dst);
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Called when the download is completed to overwrite the old file with the
* new file.
*/
private void replace(File dst, File src) throws IOException {
File bak = Util.changeExtension(dst, ".bak");
bak.delete();
dst.renameTo(bak);
dst.delete(); // any failure up to here is no big deal
if (!src.renameTo(dst)) {
throw new IOException("Failed to rename " + src + " to " + dst);
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Called when the download is completed to overwrite
* the old file with the new file.
*/
protected void replace(File dst, File src) throws IOException {
File bak = Util.changeExtension(dst,".bak");
bak.delete();
dst.renameTo(bak);
dst.delete(); // any failure up to here is no big deal
if(!src.renameTo(dst)) {
throw new IOException("Failed to rename "+src+" to "+dst);
}
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Called when the download is completed to overwrite
* the old file with the new file.
*/
protected void replace(File dst, File src) throws IOException {
File bak = Util.changeExtension(dst,".bak");
bak.delete();
dst.renameTo(bak);
dst.delete(); // any failure up to here is no big deal
if(!src.renameTo(dst)) {
throw new IOException("Failed to rename "+src+" to "+dst);
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Called when the download is completed to overwrite
* the old file with the new file.
*/
protected void replace(File dst, File src) throws IOException {
File bak = Util.changeExtension(dst,".bak");
bak.delete();
dst.renameTo(bak);
dst.delete(); // any failure up to here is no big deal
if(!src.renameTo(dst)) {
throw new IOException("Failed to rename "+src+" to "+dst);
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Called when the download is completed to overwrite
* the old file with the new file.
*/
protected void replace(File dst, File src) throws IOException {
File bak = Util.changeExtension(dst,".bak");
bak.delete();
dst.renameTo(bak);
dst.delete(); // any failure up to here is no big deal
if(!src.renameTo(dst)) {
throw new IOException("Failed to rename "+src+" to "+dst);
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public String getBackupVersion() throws IOException {
File backupFile = Util.changeExtension(hpiArchive, ".bak");
if (backupFile.exists()) {
InstalledPluginInfo bakPluginInfo = new InstalledPluginInfo(backupFile);
return bakPluginInfo.version;
}
return "";
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public boolean isDowngrdable() throws IOException {
File backupFile = Util.changeExtension(hpiArchive, ".bak");
if (backupFile.exists()) {
InstalledPluginInfo bakPluginInfo = new InstalledPluginInfo(backupFile);
return !bakPluginInfo.version.trim().equals(version);
}
return false;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Called when the download is completed to overwrite
* the old file with the new file.
*/
@Override
protected void replace(File dst, File src) throws IOException {
verifyChecksums(plugin.getSha1(), getComputedSHA1(), src);
File bak = Util.changeExtension(dst, ".bak");
bak.delete();
final File legacy = getLegacyDestination();
if (legacy.exists()) {
if (!legacy.renameTo(bak)) {
legacy.delete();
}
}
if (dst.exists()) {
if (!dst.renameTo(bak)) {
dst.delete();
}
}
if(!src.renameTo(dst)) {
throw new IOException("Failed to rename "+src+" to "+dst);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!