本文整理了Java中org.codehaus.plexus.util.FileUtils.basename()
方法的一些代码示例,展示了FileUtils.basename()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.basename()
方法的具体详情如下:
包路径:org.codehaus.plexus.util.FileUtils
类名称:FileUtils
方法名:basename
[英]Returns the filename portion of a file specification string. Matches the equally named unix command.
[中]返回文件规范字符串的文件名部分。匹配同名的unix命令。
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Returns the filename portion of a file specification string. Matches the equally named unix command.
*
* @param filename the file path
* @return The filename string without extension.
*/
public static String basename( String filename )
{
return basename( filename, extension( filename ) );
}
代码示例来源:origin: maven-nar/nar-maven-plugin
@Override
public File getNarUnpackDirectory(final File baseUnpackDirectory, final File narFile) {
final File dir = new File(baseUnpackDirectory, FileUtils.basename(narFile.getPath(), "."
+ NarConstants.NAR_EXTENSION));
return dir;
}
代码示例来源:origin: maven-nar/nar-maven-plugin
@Override
public File getNarUnpackDirectory(final File baseUnpackDirectory, final File narFile) {
final File dir = new File(baseUnpackDirectory, FileUtils.basename(narFile.getPath(), "."
+ NarConstants.NAR_EXTENSION));
return dir;
}
代码示例来源:origin: org.codehaus.gmaven.runtime/gmaven-runtime-support
public String getScriptName() {
try {
// TODO: Use URL.toURI() once Java 5 is the base platform
File file = new File(new URI(url.toString()).getPath());
return FileUtils.basename(file.getName(), "." + FileUtils.extension(file.getName()));
}
catch (URISyntaxException e) {
throw new RuntimeException("Unable to determine script class name from: " + url, e);
}
}
}
代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core
/**
* Returns the filename portion of a file specification string.
* Matches the equally named unix command.
*
* @return The filename string without extension.
*/
public static String basename( String filename )
{
return basename( filename, extension( filename ) );
}
代码示例来源:origin: org.codehaus.groovy.maven.runtime/gmaven-runtime-support
public String getScriptName() {
try {
// TODO: Use URL.toURI() once Java 5 is the base platform
File file = new File(new URI(url.toString()).getPath());
return FileUtils.basename(file.getName(), "." + FileUtils.extension(file.getName()));
}
catch (URISyntaxException e) {
throw new RuntimeException("Unable to determine script class name from: " + url, e);
}
}
}
代码示例来源:origin: org.codehaus.mojo.natives/maven-native-api
public File getOutputFile( File src )
{
String srcPath = src.getPath();
String destPath = this.getOutputDirectory().getPath() + "/" + FileUtils.basename( srcPath ) + "res";
return new File( destPath );
}
代码示例来源:origin: maven-nar/nar-maven-plugin
@Override
public void unpackNar(final File unpackDir, final ArchiverManager archiverManager, final File file, final String os,
final String linkerName, final AOL defaultAOL) throws MojoExecutionException, MojoFailureException {
final File flagFile = new File(unpackDir, FileUtils.basename(file.getPath(), "." + NarConstants.NAR_EXTENSION)
+ ".flag");
boolean process = false;
if (!unpackDir.exists()) {
unpackDir.mkdirs();
process = true;
} else if (!flagFile.exists()) {
process = true;
} else if (file.lastModified() > flagFile.lastModified()) {
process = true;
}
if (process) {
try {
unpackNarAndProcess(archiverManager, file, unpackDir, os, linkerName, defaultAOL);
FileUtils.fileDelete(flagFile.getPath());
FileUtils.fileWrite(flagFile.getPath(), "");
} catch (final IOException e) {
throw new MojoFailureException("Cannot create flag file: " + flagFile.getPath(), e);
}
}
}
}
代码示例来源:origin: org.codehaus.mojo.natives/maven-native-api
objectFileName = FileUtils.basename( sourceFile.getCanonicalPath() );
代码示例来源:origin: io.ultreia.java4all.eugene/eugene-core
String name = FileUtils.basename(stateModelFile.getName(), "." + ext);
File propFile = new File(dir, name + ".properties");
RecursiveProperties prop = new RecursiveProperties();
代码示例来源:origin: antlr/antlr3
System.out.println( "Executing script " + scriptPath );
try {
String scriptBaseName = StringUtils.chompLast( FileUtils.basename( script.getName() ), "." );
代码示例来源:origin: org.grouplens.lenskit/lenskit-eval-ant-plugin
for (int i = 0; i < dbFiles.length; i++) {
File dbf = dbFiles[i];
String name = FileUtils.basename(dbf.getName(), ".db");
String dsn = "jdbc:sqlite:" + dbf.getPath();
TrainTestPredictEvaluator eval = new TrainTestPredictEvaluator(dsn, "train", "test");
代码示例来源:origin: io.ultreia.java4all.eugene/eugene-core
String name = FileUtils.basename(file.getName(), "." + ext);
File propFile = new File(dir, name + ".properties");
if (!propFile.exists()) {
内容来源于网络,如有侵权,请联系作者删除!