本文整理了Java中org.esa.snap.core.util.io.FileUtils.getFileNameFromPath()
方法的一些代码示例,展示了FileUtils.getFileNameFromPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.getFileNameFromPath()
方法的具体详情如下:
包路径:org.esa.snap.core.util.io.FileUtils
类名称:FileUtils
方法名:getFileNameFromPath
暂无
代码示例来源:origin: senbox-org/s2tbx
@Override
public String[] listAll(Pattern...patterns) {
String[] list = super.listAll(patterns);
Arrays.stream(list).forEach(item -> files.put(FileUtils.getFileNameFromPath(item).toLowerCase(), item));
return list;
}
代码示例来源:origin: senbox-org/s2tbx
private String findKeyFile(String key) {
if (key == null || key.isEmpty())
return null;
String ret = files.get(key);
if (ret == null) {
String namePart = FileUtils.getFilenameWithoutExtension(FileUtils.getFileNameFromPath(key));
String extPart = FileUtils.getExtension(key);
ret = firstOrDefault(files.keySet(),
k -> {
String name = FileUtils.getFilenameWithoutExtension(FileUtils.getFileNameFromPath(k));
name = name.substring(name.lastIndexOf("/") + 1);
return (extPart != null && extPart.equalsIgnoreCase(FileUtils.getExtension(k))) && namePart.equals(name);
});
//If no identical name found, look for a name that could be a truncated name of key (needed for some Deimos products)
if(ret == null) {
ret = firstOrDefault(files.keySet(),
k -> {
String name = FileUtils.getFilenameWithoutExtension(FileUtils.getFileNameFromPath(k));
name = name.substring(name.lastIndexOf("/") + 1);
return (extPart != null && extPart.equalsIgnoreCase(FileUtils.getExtension(k))) && namePart.startsWith(name);
});
}
}
return ret;
}
}
代码示例来源:origin: senbox-org/s2tbx
String key = FileUtils.getFileNameFromPath(s).toLowerCase();
String path = findKeyFile(key);
if (path == null)
代码示例来源:origin: senbox-org/s2tbx
@Override
public File getFile(String relativePath) throws IOException {
File file;
try {
file = wrapped.getFile(relativePath);
} catch (IOException e) {
try {
file = wrapped.getFile(relativePath.toUpperCase());
} catch (IOException ex) {
file = new File(wrapped.getTempDir(), relativePath);
}
}
if (file == null || !file.exists()) {
String key = FileUtils.getFileNameFromPath(relativePath).toLowerCase();
String path = findKeyFile(key);
if (path == null)
throw new IOException(String.format("File %s does not exist", relativePath));
relativePath = path;
try {
// the "classic" way
file = getFileInner(relativePath);
} catch (IOException e) {
file = !isArchive() ? new File(wrapped.getTempDir() + File.separator + relativePath) : getFileInner(relativePath);
}
}
return file;
}
代码示例来源:origin: senbox-org/snap-desktop
static boolean insertImageLayer(LayerSourcePageContext pageContext) {
AffineTransform transform = (AffineTransform) pageContext.getPropertyValue(PROPERTY_NAME_WORLD_TRANSFORM);
String imageFilePath = (String) pageContext.getPropertyValue(PROPERTY_NAME_IMAGE_FILE_PATH);
try {
ProductSceneView sceneView = SnapApp.getDefault().getSelectedProductSceneView();
final ImageFileLayerType type = LayerTypeRegistry.getLayerType(ImageFileLayerType.class);
final PropertySet configuration = type.createLayerConfig(sceneView);
configuration.setValue(ImageFileLayerType.PROPERTY_NAME_IMAGE_FILE, new File(imageFilePath));
configuration.setValue(ImageFileLayerType.PROPERTY_NAME_WORLD_TRANSFORM, transform);
Layer layer = type.createLayer(sceneView, configuration);
layer.setName(FileUtils.getFileNameFromPath(imageFilePath));
Layer rootLayer = sceneView.getRootLayer();
rootLayer.getChildren().add(sceneView.getFirstImageLayerIndex(), layer);
return true;
} catch (Exception e) {
pageContext.showErrorDialog(e.getMessage());
return false;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!