下面列出了org.springframework.util.StringUtils#getFilename ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void generate(Directory root, File pomFile, boolean generateChecksums) {
String name = StringUtils.getFilename(pomFile.getName());
String extension = StringUtils.getFilenameExtension(pomFile.getName());
String prefix = name.substring(0, name.length() - extension.length() - 1);
File[] files = pomFile.getParentFile().listFiles((f) -> include(f, prefix));
MultiValueMap<File, MavenCoordinates> fileCoordinates = new LinkedMultiValueMap<>();
for (File file : files) {
String rootPath = StringUtils.cleanPath(root.getFile().getPath());
String relativePath = StringUtils.cleanPath(file.getPath()).substring(rootPath.length() + 1);
fileCoordinates.add(file.getParentFile(), MavenCoordinates.fromPath(relativePath));
}
fileCoordinates.forEach((file, coordinates) -> writeMetadata(file, coordinates, generateChecksums));
}
/**
* This implementation returns the name of the file that this URL refers to.
* @see java.net.URL#getPath()
*/
@Override
public String getFilename() {
return StringUtils.getFilename(this.cleanedUrl.getPath());
}
/**
* This implementation returns the name of the file that this class path
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
@Nullable
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* This implementation returns the name of the file that this ServletContext
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
@Nullable
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* This implementation returns the name of the file that this URL refers to.
* @see java.net.URL#getPath()
*/
@Override
public String getFilename() {
return StringUtils.getFilename(this.cleanedUrl.getPath());
}
/**
* This implementation returns the name of the file that this class path
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
@Nullable
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* This implementation returns the name of the file that this ServletContext
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
@Nullable
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* This implementation returns the name of the file that this URL refers to.
* @see java.net.URL#getPath()
*/
@Override
public String getFilename() {
return StringUtils.getFilename(this.cleanedUrl.getPath());
}
@Override
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* 获取文件后缀名
*
* @param path 文件路径
* @return {String}
*/
@Nullable
public static String getFilename(@Nullable String path) {
return StringUtils.getFilename(path);
}
/**
* This implementation returns the name of the file that this ServletContext
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* This implementation returns the name of the file that this class path
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* This implementation returns the name of the file that this class path
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
public String getFilename() {
return StringUtils.getFilename(this.path);
}
/**
* This implementation returns the name of the file that this ServletContext
* resource refers to.
* @see org.springframework.util.StringUtils#getFilename(String)
*/
@Override
public String getFilename() {
return StringUtils.getFilename(this.path);
}