Example usage for java.io File separatorChar

List of usage examples for java.io File separatorChar

Introduction

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

Prototype

char separatorChar

To view the source code for java.io File separatorChar.

Click Source Link

Document

The system-dependent default name-separator character.

Usage

From source file:com.squid.kraken.v4.auth.KrakenClientConfig.java

@Deprecated
private static void initProperties(String filePath) {
    String path = null;//from   www . j a  v  a 2s.c om

    // load the config file from user.home
    FileInputStream is;
    try {
        path = filePath + File.separatorChar + CONFIG_FILEPATH_DEV;
        is = new FileInputStream(path);
        logger.warn("Loading config from : " + path);
        load(is, props);
    } catch (FileNotFoundException e) {
        try {
            path = filePath + File.separatorChar + CONFIG_FILEPATH;
            is = new FileInputStream(path);
            logger.warn("Loading config from : " + path);
            load(is, props);
        } catch (FileNotFoundException e2) {
            throw new RuntimeException("Configuration file not found : " + path);
        }
    }
}

From source file:net.sourceforge.floggy.persistence.pool.DirectoryOutputPool.java

/**
 * DOCUMENT ME!//  w  w w  . j a  v  a2  s  . c  o  m
*
* @param resourceStream DOCUMENT ME!
* @param fileName DOCUMENT ME!
*
* @throws IOException DOCUMENT ME!
*/
public void addResource(InputStream resourceStream, String fileName) throws IOException {
    File temp;
    int lastIndex = fileName.lastIndexOf(File.separatorChar);

    if (lastIndex == -1) {
        temp = directory;
    } else {
        temp = new File(directory, fileName.substring(0, lastIndex));
    }

    if (!temp.exists()) {
        temp.mkdirs();
    }

    write(resourceStream, new File(temp, fileName.substring(lastIndex + 1)));
}

From source file:edu.stanford.muse.webapp.Sessions.java

public static String getArchivesIndexFilename() {
    //return getDefaultSessionDir() + File.separatorChar + "archives.xml";
    return getDefaultRootDir() + File.separatorChar + "archives.xml";
}

From source file:com.stimulus.archiva.domain.FileSystem.java

public void setApplicationPath(String applicationPath) {

    if (applicationPath.endsWith(Character.toString(File.separatorChar)))
        this.applicationPath = applicationPath.substring(0, applicationPath.length() - 1);
    else/*  w w w .j av  a2  s .  co m*/
        this.applicationPath = applicationPath;
    logger.debug("setApplicationPath {path='" + applicationPath + "'}");
}

From source file:com.norconex.collector.core.pipeline.importer.SaveDocumentStage.java

public static String urlToPath(final String url) {
    if (url == null) {
        return null;
    }/*from  w w w.  j a  v  a2 s.c  o  m*/
    String sep = File.separator;
    if (sep.equals("\\")) {
        sep = "\\" + sep;
    }

    String domain = url.replaceFirst("(.*?)(://)(.*?)(/)(.*)", "$1_$3");
    domain = domain.replaceAll("[\\W]+", "_");
    String path = url.replaceFirst("(.*?)(://)(.*?)(/)(.*)", "$5");

    String[] segments = path.split("[\\/]");
    StringBuilder b = new StringBuilder();
    for (int i = 0; i < segments.length; i++) {
        String segment = segments[i];
        if (StringUtils.isNotBlank(segment)) {
            boolean lastSegment = (i + 1) == segments.length;
            String[] segParts = splitLargeSegment(segment);
            for (int j = 0; j < segParts.length; j++) {
                String segPart = segParts[j];
                if (b.length() > 0) {
                    b.append(File.separatorChar);
                }
                // Prefixes directories or files with different letter
                // to ensure directory and files can't have the same 
                // names (github #44).
                if (lastSegment && (j + 1) == segParts.length) {
                    b.append("f.");
                } else {
                    b.append("d.");
                }
                b.append(FileUtil.toSafeFileName(segPart));
            }
        }
    }
    if (b.length() > 0) {
        return "d." + domain + File.separatorChar + b.toString();
    }
    return "f." + domain;
}

From source file:com.eviware.soapui.support.Tools.java

public static String getFilename(String filePath) {
    if (filePath == null || filePath.length() == 0) {
        return filePath;
    }//from  www . ja v a  2  s .com

    int ix = filePath.lastIndexOf(File.separatorChar);
    if (ix <= 0) {
        return filePath;
    }

    return filePath.substring(ix + 1, filePath.length());
}

From source file:net.sourceforge.floggy.persistence.pool.ZipOutputPool.java

/**
 * DOCUMENT ME!//  w ww. j a  v a2 s.c om
*
* @param resourceStream DOCUMENT ME!
* @param fileName DOCUMENT ME!
*
* @throws IOException DOCUMENT ME!
*/
public void addResource(InputStream resourceStream, String fileName) throws IOException {
    fileName = fileName.replace(File.separatorChar, '/');

    if (fileName.startsWith("/")) {
        fileName = fileName.substring(1);
    }

    ZipEntry entry = new ZipEntry(fileName);
    out.putNextEntry(entry);
    IOUtils.copy(resourceStream, out);
    out.closeEntry();
}

From source file:de.ailis.wlandsuite.PackHtds.java

/**
 * @see de.ailis.wlandsuite.cli.PackProg#pack(java.io.File,
 *      java.io.OutputStream)/* w  w w  .  j  a v a  2s  .  c o  m*/
 */

@Override
public void pack(File directory, OutputStream output) throws IOException {
    Htds htds;
    List<HtdsTileset> tilesets;
    List<Pic> tiles;
    int tilesetNo, tileNo;
    File file;
    File tilesetDir;

    tilesets = new ArrayList<HtdsTileset>();
    tilesetNo = 0;
    while (true) {
        tileNo = 0;
        tilesetDir = new File(
                String.format("%s%c%03d", new Object[] { directory.getPath(), File.separatorChar, tilesetNo }));
        if (!tilesetDir.exists()) {
            break;
        }
        log.info("Reading tileset " + tilesetNo);
        tiles = new ArrayList<Pic>();
        while (true) {
            file = new File(String.format("%s%c%03d.png",
                    new Object[] { tilesetDir.getPath(), File.separatorChar, tileNo }));
            if (!file.exists()) {
                break;
            }
            tiles.add(new Pic(ImageIO.read(file)));
            tileNo++;
        }
        tilesets.add(new HtdsTileset(tiles));
        tilesetNo++;
    }

    htds = new Htds(tilesets);

    if (this.disk == -1) {
        htds.write(output);
    } else {
        htds.write(output, this.disk);
    }
}

From source file:it.wingstech.csslesser.LessifyMojo.java

@Override
public void execute() throws MojoExecutionException {
    srcFolderName = srcFolderName.replace('\\', File.separatorChar).replace('/', File.separatorChar);
    outputFolderName = outputFolderName.replace('\\', File.separatorChar).replace('/', File.separatorChar);
    if (lessResources == null || lessResources.length == 0) {
        lessResources = new Resource[1];
        lessResources[0] = new Resource();
        lessResources[0].setDirectory(srcFolderName);
    }//from  ww w. java2  s  .c  o m
    for (Resource resource : lessResources) {
        String[] resources = getIncludedFiles(resource);
        String directory = resource.getDirectory();
        getLog().info("Copying resources...");
        for (String path : resources) {
            try {
                FileUtils.copyFile(
                        new File(project.getBasedir() + File.separator + directory + File.separator + path),
                        new File(outputFolderName + File.separator + path));
            } catch (IOException e) {
                throw new MojoExecutionException(e.getMessage(), e);
            }
        }
        if (lessify) {
            getLog().info("Performing less transformation...");
            LessEngine engine = new LessEngine();
            for (String path : resources) {
                if (path.toUpperCase().endsWith(".LESS")) {
                    try {
                        File inputFile = new File(outputFolderName + File.separator + path);
                        File outputFile = new File(outputFolderName + File.separator
                                + path.substring(0, path.length() - 5) + ".css");

                        getLog().info("LESS processing file: " + path + " ...");
                        engine.compile(inputFile, outputFile);
                    } catch (Exception e) {
                        throw new MojoExecutionException(e.getMessage(), e);
                    }
                }
            }
        }
        if (cssCompress) {
            getLog().info("Performing css compression...");
            Collection<File> inputFiles = FileUtils.listFiles(new File(outputFolderName),
                    new String[] { "css" }, true);
            for (File inputFile : inputFiles) {
                getLog().info("Compressing file: " + inputFile.getPath() + " ...");
                compress(inputFile);
            }
        }
        if (cssInline) {
            getLog().info("Performing css inlining...");
            Collection<File> inputFiles = FileUtils.listFiles(new File(outputFolderName),
                    new String[] { "css" }, true);
            for (File inputFile : inputFiles) {
                getLog().info("Inlining file: " + inputFile.getPath() + " ...");
                inline(inputFile, ".");
            }
        }
    }
}

From source file:dsd.controller.ParserControler.java

private static String GetStoredPath(File file, eFileType fileType) {
    String storedFolderPathForPictures = "ParsedImages" + File.separatorChar;
    String storedFolderPathForTextFiles = "ParsedTextFiles" + File.separatorChar;

    switch (fileType) {
    case Sonar:/*from   w w w. j  a va 2  s.co m*/
        return storedFolderPathForTextFiles + file.getName();
    case Analog:
        return storedFolderPathForTextFiles + file.getName();
    case Mantova:
        return storedFolderPathForPictures + file.getName();
    case Modena:
        return storedFolderPathForPictures + file.getName();
    default:
        throw new IllegalArgumentException("File type not recognized");
    }
}