本文整理了Java中org.esa.snap.core.util.io.FileUtils.getExtension()
方法的一些代码示例,展示了FileUtils.getExtension()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.getExtension()
方法的具体详情如下:
包路径:org.esa.snap.core.util.io.FileUtils
类名称:FileUtils
方法名:getExtension
暂无
代码示例来源:origin: senbox-org/s2tbx
public static boolean isTar(String filename) {
return ".tar".equals(FileUtils.getExtension(filename));
}
代码示例来源:origin: senbox-org/s2tbx
public static boolean isValidExtension (File file) {
boolean validExtension = false;
final String extension = FileUtils.getExtension(file);
if (extension == null) {
validExtension = true;
} else {
for (String allowedExtension : allowedExtensions) {
if (extension.startsWith(allowedExtension)) {
validExtension = true;
break;
}
}
}
return validExtension;
}
代码示例来源:origin: senbox-org/s2tbx
public static boolean isTgz(String filename) {
final String extension = FileUtils.getExtension(filename);
return (".tgz".equals(extension) || ".gz".equals(extension));
}
代码示例来源:origin: senbox-org/s1tbx
static File findAnnotationFile(final File uavDatafile) {
final File parentDir = uavDatafile.getParentFile();
final File[] listFiles = parentDir.listFiles();
if (listFiles == null)
return null;
for (File f : listFiles) {
final String ext = FileUtils.getExtension(f);
if (ext != null && ext.equalsIgnoreCase(".ann")) {
return f;
}
}
return null;
}
代码示例来源:origin: senbox-org/s1tbx
private void getProductType(final File inputFile) {
final String ext = FileUtils.getExtension(inputFile);
if (ext != null) {
productTypeStr = ext.substring(1).toUpperCase();
switch (productTypeStr) {
case "SLC":
productType = ProductTypes.SLC;
break;
case "GRD":
productType = ProductTypes.GRD;
break;
case "DAT":
productType = ProductTypes.DAT;
break;
default:
productType = ProductTypes.MLC;
break;
}
}
}
代码示例来源:origin: senbox-org/s2tbx
@Override
public DecodeQualification getDecodeQualification(Object input) {
DecodeQualification result = DecodeQualification.UNABLE;
if (input != null) {
File fileInput = null;
if (input instanceof String) {
fileInput = new File((String) input);
} else if (input instanceof File) {
fileInput = (File) input;
}
if (fileInput != null) {
final String ext = FileUtils.getExtension(fileInput);
if (".jp2".equalsIgnoreCase(ext)) {
result = DecodeQualification.SUITABLE;
}
}
}
return result;
}
代码示例来源:origin: senbox-org/s2tbx
/**
* Helper method to check if a file is either packed (i.e. tar file) or compressed.
* The test is performed agains a set of pre-defined file extensions.
* @param file The file to be tested
* @return <code>true</code> if the file is packed or compressed, <code>false</code> otherwise
*/
public static boolean isPackedFile(File file) {
String extension = FileUtils.getExtension(file);
return !StringUtils.isNullOrEmpty(extension) && compressedExtensions.contains(extension.toLowerCase());
}
代码示例来源:origin: senbox-org/s1tbx
private boolean isComplex(final File file) {
String name = file.getName().toLowerCase();
name = FileUtils.getFilenameWithoutExtension(name);
String ext = FileUtils.getExtension(name);
return ext != null && (ext.endsWith("slc") || ext.endsWith("diff"));
}
代码示例来源:origin: senbox-org/s1tbx
private boolean isCoregistered(final File file) {
String name = file.getName().toLowerCase();
name = FileUtils.getFilenameWithoutExtension(name);
String ext = FileUtils.getExtension(name);
return ext != null && ext.endsWith("rslc");
}
代码示例来源:origin: senbox-org/s1tbx
private static String createName(final File file, final int n) {
return FileUtils.getFilenameWithoutExtension(file) + '_' + n + FileUtils.getExtension(file);
}
代码示例来源:origin: senbox-org/snap-desktop
private String createWorldFilePath(String imageFilePath) {
String imageFileExt = FileUtils.getExtension(imageFilePath);
// Rule for world file extension: <name>.<a><b><c> --> <name>.<a><c>w
// see http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=17489
String worldFilePath;
if (imageFileExt != null && imageFileExt.length() == 4) { // three chars + leading dot
String worldFileExt = imageFileExt.substring(0, 2) +
imageFileExt.charAt(imageFileExt.length() - 1) + "w";
worldFilePath = FileUtils.exchangeExtension(imageFilePath, worldFileExt);
} else {
worldFilePath = imageFilePath + "w";
}
return worldFilePath;
}
代码示例来源:origin: senbox-org/s1tbx
private File createParFile(final File file) {
String name = FileUtils.getFilenameWithoutExtension(file);
String ext = FileUtils.getExtension(name);
String newExt = GammaConstants.PAR_EXTENSION;
if (ext == null) {
if (isComplex) {
if (isCoregistered) {
newExt = ".rslc" + newExt;
} else {
newExt = ".slc" + newExt;
}
}
}
name += newExt;
return new File(file.getParent(), name);
}
}
代码示例来源:origin: senbox-org/s1tbx
@Override
public DecodeQualification getDecodeQualification(Object input) {
try{
final Object imageIOInput;
if (input instanceof String){
imageIOInput = new File((String) input);
} else if (input instanceof File || input instanceof InputStream){
imageIOInput = input;
} else{
return DecodeQualification.UNABLE;
}
if(input instanceof String || input instanceof File){
final String extension = FileUtils.getExtension((File)imageIOInput).toUpperCase();
if (extension.equals(".ZIP")){
return checkZIPFile(imageIOInput);
}
final String name = ((File) imageIOInput).getAbsolutePath();
return checkFileName(name);
}
return DecodeQualification.UNABLE;
}catch (Exception e){
e.printStackTrace();
return DecodeQualification.UNABLE;
}
}
代码示例来源:origin: senbox-org/s1tbx
/**
* Checks whether the given object is an acceptable input for this product reader and if so, the method checks if it
* is capable of decoding the input's content.
*
* @param input any input object
* @return true if this product reader can decode the given input, otherwise false.
*/
public DecodeQualification getDecodeQualification(final Object input) {
final File file = ReaderUtils.getFileFromInput(input);
if (file != null) {
String ext = FileUtils.getExtension(file);
if (ext != null) {
ext = ext.toLowerCase();
for (String uavExt : FORMAT_FILE_EXTENSIONS) {
if (ext.endsWith(uavExt)) {
if (UAVSARReader.findAnnotationFile(file) != null)
return DecodeQualification.INTENDED;
}
}
}
}
return DecodeQualification.UNABLE;
}
代码示例来源: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/snap-desktop
fileExtension = FileUtils.getExtension(file);
代码示例来源:origin: senbox-org/snap-desktop
setIODir(file.getAbsoluteFile().getParentFile());
SnapFileFilter snapFileFilter = fileChooser.getSnapFileFilter();
String fileExtension = FileUtils.getExtension(file);
if (fileExtension == null || !StringUtils.contains(snapFileFilter.getExtensions(), fileExtension)) {
file = FileUtils.ensureExtension(file, snapFileFilter.getDefaultExtension());
内容来源于网络,如有侵权,请联系作者删除!