Example usage for java.io File getName

List of usage examples for java.io File getName

Introduction

In this page you can find the example usage for java.io File getName.

Prototype

public String getName() 

Source Link

Document

Returns the name of the file or directory denoted by this abstract pathname.

Usage

From source file:Main.java

public static boolean isWMVFile(File f) {
    return isWMVFile(f.getName());
}

From source file:br.edimarmanica.weir2.rule.type.RulesDataTypeController.java

/**
 * Persiste the datatype of each rule/*from  ww w.  java2  s  . c  om*/
 *
 * @param site
 */
public static void persiste(Site site) {
    Map<String, DataType> ruleType = new HashMap<>();

    File dirInput = new File(Paths.PATH_INTRASITE + "/" + site.getPath() + "/extracted_values");
    for (File rule : dirInput.listFiles()) {
        ruleType.put(rule.getName(), RuleDataType.getMostFrequentType(rule));
    }

    File dirOutput = new File(Paths.PATH_WEIR_V2 + "/" + site.getPath());
    dirOutput.mkdirs();

    File file = new File(dirOutput.getAbsolutePath() + "/types.csv");
    String[] HEADER = { "RULE", "TYPE" };
    CSVFormat format = CSVFormat.EXCEL.withHeader(HEADER);

    try (Writer out = new FileWriter(file)) {
        try (CSVPrinter csvFilePrinter = new CSVPrinter(out, format)) {
            for (String rule : ruleType.keySet()) {
                List<String> dataRecord = new ArrayList<>();
                dataRecord.add(rule);
                dataRecord.add(ruleType.get(rule).name());
                csvFilePrinter.printRecord(dataRecord);
            }
        }
    } catch (IOException ex) {
        Logger.getLogger(RulesDataTypeController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.googlecode.hiberpcml.generator.Tool.java

public static ArrayList<File> getFilesToParse(File sourceFile) {
    ArrayList<File> files = new ArrayList<File>();
    if (sourceFile == null || !sourceFile.exists()) {
        return files;
    }/*from  ww  w .j a  v  a 2  s.c om*/

    if (sourceFile.isDirectory()) {
        for (File file : sourceFile.listFiles()) {
            if (file.isFile() && file.getName().toLowerCase().endsWith(".pcml")) {
                files.add(file);
            }
        }
    } else {
        files.add(sourceFile);
    }

    return files;
}

From source file:com.netsteadfast.greenstep.util.PdfConvertUtils.java

public static List<String> toImageUpload(File pdfFile, int resolution, String system, String uploadType,
        boolean isFile) throws ServiceException, Exception {
    List<String> oids = new LinkedList<String>();
    List<File> imageFiles = toImageFiles(pdfFile, resolution);
    for (File file : imageFiles) {
        oids.add(UploadSupportUtils.create(system, uploadType, isFile, file, file.getName()));
    }//from  w  w  w  .j  av a 2 s.c o  m
    return oids;
}

From source file:com.px100systems.data.utility.BackupFile.java

public static boolean isBackup(File file, String unitName) {
    return file.isFile() && file.getName().endsWith(unitName + EXTENSION);
}

From source file:com.schnobosoft.semeval.cortical.PrintCorrelations.java

private static void printCorrelations(File inputFile, Retina retinaName) throws IOException {
    assert inputFile.getName().startsWith(INPUT_FILE_PREFIX);

    File gsFile = new File(inputFile.getCanonicalPath().replace(INPUT_FILE_PREFIX, GS_FILE_PREFIX));
    List<Optional> gs = readScoresFile(gsFile);

    for (Measure correlationMeasure : Measure.values()) {
        List<Optional> scores = readScoresFile(getOutputFile(inputFile, correlationMeasure, retinaName));

        double pearson = getPearson(gs, scores);
        System.out.printf("Pearson correlation (%s, %s): %.4f%n", retinaName.name().toLowerCase(),
                correlationMeasure, pearson);
    }//from  ww w.ja va  2  s . com
}

From source file:Main.java

public static boolean isRIFFFile(File f) {
    return isRIFFFile(f.getName());
}

From source file:Main.java

public static String getMIMETypeFromUrl(final File file, final String defaultValue) {

    MimeTypeMap mime = MimeTypeMap.getSingleton();
    int index = file.getName().lastIndexOf('.') + 1;
    String ext = file.getName().substring(index).toLowerCase();
    final String mimeType = mime.getMimeTypeFromExtension(ext);

    if (mimeType != null) {
        return mimeType;
    }//from   www . j a va2s  .com

    return defaultValue;
}

From source file:com.starit.diamond.utils.AppNameUtils.java

private static void addFilesToAppNames(File[] files, List<String> appNames, String suffix) {
    if (files != null) {
        for (File file : files) {
            String filename = file.getName();
            String appName = filename.substring(0, filename.length() - suffix.length());
            appNames.add(appName);//from  w  w w .  j a v  a2s  .  com
        }
    }
}

From source file:es.amplia.research.maven.protodocbook.tools.FileHelper.java

public static boolean copyDir(File _in, File _out) {
    try {//from w w  w .  ja va  2s  .  com
        log.info("Copying " + _in.getName() + " to " + _out.getAbsolutePath());
        FileUtils.copyDirectory(_in, _out);
        return true;
    } catch (IOException e) {
        log.error("File copy error", e);
        return false;
    }
}