Example usage for java.io File toString

List of usage examples for java.io File toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns the pathname string of this abstract pathname.

Usage

From source file:com.photon.phresco.framework.param.impl.PerformanceTestDetailsImpl.java

private String testResultJsonFile(String rootModulePath, String subModuleName, String testAgainst,
        String testResultName) throws PhrescoPomException, PhrescoException {
    ProjectInfo info = Utility.getProjectInfo(rootModulePath, subModuleName);
    File testFolderLocation = Utility.getTestFolderLocation(info, rootModulePath, subModuleName);
    StringBuilder builder = new StringBuilder(testFolderLocation.toString());
    File pomFileLocation = Utility.getPomFileLocation(rootModulePath, subModuleName);
    PomProcessor processor = new PomProcessor(pomFileLocation);
    String performDir = processor.getProperty(POM_PROP_KEY_PERFORMANCETEST_DIR);
    builder.append(performDir);/*from w  w w.  j  a  va2s  .co  m*/
    builder.append(File.separator);
    builder.append(testAgainst.toLowerCase());
    builder.append(File.separator);
    builder.append(FOLDER_JSON);
    builder.append(File.separator);
    builder.append(testResultName + DOT_JSON);

    return builder.toString();
}

From source file:com.flipkart.phantom.runtime.impl.jetty.JettyWebAppContextFactory.java

/**
 * Interface method implementation. Creates and returns a WebAppContext instance
 * @see org.springframework.beans.factory.FactoryBean#getObject()
 *///from   w w  w  . j  a va 2s  . co m
public WebAppContext getObject() throws Exception {
    String path = null;
    File[] files = FileLocator.findDirectories(this.getContextPath(), null);
    for (File file : files) {
        // we need only WEB-INF from runtime project and none else even by mistake
        String fileToString = file.toString();
        if (fileToString.contains(".jar!") && fileToString.startsWith("file:/")) {
            fileToString = fileToString.replace("file:/", "jar:file:/");
            if (fileToString.contains("runtime-")) {
                path = fileToString;
                break;
            }
        } else {
            if (fileToString.contains("runtime")) {
                path = fileToString;
                break;
            }
        }
    }
    // trim off the "WEB-INF" part as the WebAppContext path should refer to the parent directory
    if (path.endsWith("WEB-INF")) {
        path = path.replace("WEB-INF", "");
    }
    WebAppContext webAppContext = new WebAppContext(path, this.getContextName());
    webAppContext.setMaxFormContentSize(this.getMaxFormContentSize());
    return webAppContext;
}

From source file:net.java.sen.Tokenizer.java

/**
 * load connect cost file (matrix.cha)//from  ww w  .j ava  2s. com
 */
private void loadConnectCost(String connectFile) throws IOException {
    FileAccessor fd = null;
    long start;

    File f = new File(connectFile);

    log.info("connection file = " + f.toString());
    start = System.currentTimeMillis();
    fd = FileAccessorFactory.getInstance(f);
    msize1 = fd.readShort();
    msize2 = fd.readShort();
    msize3 = fd.readShort();

    // first 3 value means matrix information:
    // *2 means information is short.
    // each matrix value is short, so / 2

    int len = ((int) f.length() - (3 * 2)) / 2;

    log.debug("msize1=" + msize1);
    log.debug("msize2=" + msize2);
    log.debug("msize3=" + msize3);
    log.debug("matrix size = " + len);

    matrix = new short[len];
    for (int i = 0; i < len; i++) {
        matrix[i] = fd.readShort();
    }
    log.info("time to load connect cost file = " + (System.currentTimeMillis() - start) + "[ms]");
    fd.close();
}

From source file:eu.scape_project.tika_identify.TikaIdentification.java

private synchronized void processFile(File path) throws FileNotFoundException, IOException {
    if (tihj != null) {
        String mime = tihj.identify(path.toString());
        System.out.println(path.toString() + "\t" + mime);
    } else {//from w  w  w . j  ava  2 s  .c  o m
        LOG.error("Tika identifier not available");
    }

}

From source file:com.flipkart.sp.dashboard.impl.spring.jetty.JettyWebAppContextFactory.java

/**
 * Interface method implementation. Creates and returns a WebAppContext instance
 * @see org.springframework.beans.factory.FactoryBean#getObject()
 *///from  ww w . ja  v  a 2  s.c  o m
public WebAppContext getObject() throws Exception {
    String path = null;
    File[] files = FileLocator.findDirectories(this.getContextPath(), null);
    for (File file : files) {
        // we need only WEB-INF from dashboard project and none else even by mistake
        String fileToString = file.toString();
        if (fileToString.contains(".jar!") && fileToString.startsWith("file:/")) {
            fileToString = fileToString.replace("file:/", "jar:file:/");
            if (fileToString.contains("dashboard-")) {
                path = fileToString;
                break;
            }
        } else {
            if (fileToString.contains("dashboard")) {
                path = fileToString;
                break;
            }
        }
    }
    // trim off the "WEB-INF" part as the WebAppContext path should refer to the parent directory
    if (path.endsWith("WEB-INF")) {
        path = path.replace("WEB-INF", "");
    }
    WebAppContext webAppContext = new WebAppContext(path, this.getContextName());
    webAppContext.setMaxFormContentSize(this.getMaxFormContentSize());
    return webAppContext;
}

From source file:gobblin.aws.AWSJobConfigurationManagerTest.java

@Test(enabled = false)
private String getJobConfigZipUri(File source) throws IOException {
    final File destination = new File(
            StringUtils.substringBeforeLast(source.toString(), File.separator) + File.separator + URI_ZIP_NAME);
    if (destination.exists()) {
        if (!destination.delete()) {
            throw new IOException("Cannot clean destination job conf zip file: " + destination);
        }//from   w  ww .j a va  2 s . co  m
    }
    FileUtils.copyFile(source, destination);

    return destination.toURI().toString();
}

From source file:channellistmaker.listmaker.EPGListMaker.java

/**
 * EPG XML????????//from   w  w w.  java 2s .c  o  m
 *
 * @return ???????Document????????
 */
public synchronized Set<Document> seek() {
    Set<Document> EPGs = Collections.synchronizedSet(new HashSet<Document>());
    List<File> FL = this.seeker.seek();
    for (File F : FL) {
        Document d = new XMLLoader(charset).Load(F);
        if (d != null) {
            LOG.info("EPG?????? EPG FILE = " + F.toString());
            EPGs.add(d);
        } else {
            LOG.warn(
                    "EPG?????????????? EPG FILE = "
                            + F.toString());
        }
    }
    return Collections.unmodifiableSet(EPGs);
}

From source file:com.ariht.maven.plugins.config.io.DirectoryReader.java

/**
 * Return collection of all files in directory and sub-directories, ignoring any that
 * have been specifically excluded in plugin configuration.
 *//* w  w w  . j  av  a 2  s.  com*/
@SuppressWarnings("rawtypes")
private Collection<File> getAllFiles(final File directory, final List<File> filesToIgnore) {
    if (!directory.exists()) {
        log.warn("Directory does not exist: " + directory.getPath());
        return EMPTY_FILE_LIST;
    }
    final Collection allFiles = FileUtils.listFiles(directory, TrueFileFilter.TRUE,
            DirectoryFileFilter.DIRECTORY);
    final Collection<File> files = new ArrayList<File>(allFiles.size());
    for (final Object o : allFiles) {
        if (o != null && o instanceof File) {
            final File file = (File) o;
            if (isFileToIgnore(file, filesToIgnore)) {
                log.debug("Ignoring : " + file.toString());
            } else {
                log.debug("Adding file: " + file.toString());
                files.add(file);
            }
        } else {
            log.warn("Not a file: " + ToStringBuilder.reflectionToString(o));
        }
    }
    return files;
}

From source file:eu.scape_project.droid_identify.DroidIdentification.java

private synchronized void processFile(File path) throws FileNotFoundException, IOException {
    if (dihj != null) {
        String puid = dihj.identify(path.toString());
        System.out.println(path.toString() + "\t" + puid);
    } else {//from ww  w. j  a  v a2  s  .  c o  m
        LOG.error("Droid identifier not available");
    }

}

From source file:org.alfresco.extension.bulkfilesystemimport.impl.AbstractBulkFilesystemImporter.java

public final static String getFileName(final File file) {
    String result = null;/*from  w  w w  .j  av  a 2 s .c o  m*/

    if (file != null) {
        try {
            result = file.getCanonicalPath();
        } catch (final IOException ioe) {
            result = file.toString();
        }
    }

    return (result);
}