Example usage for java.io File separator

List of usage examples for java.io File separator

Introduction

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

Prototype

String separator

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

Click Source Link

Document

The system-dependent default name-separator character, represented as a string for convenience.

Usage

From source file:Main.java

private static String getTempLocation() {

    String tmpdir = System.getProperty("java.io.tmpdir");
    StringBuilder sb = new StringBuilder();
    sb.append(tmpdir);//from  w w  w .  ja v  a  2  s . com

    if (!tmpdir.endsWith(File.separator))
        sb.append(File.separator);

    sb.append("TempAzure");
    sb.append(File.separator);
    sb.append("MobileServiceTemplate");
    sb.append(File.separator);

    return sb.toString();
}

From source file:Main.java

public static String getFolderName(String filePath) {

    if (TextUtils.isEmpty(filePath)) {
        return filePath;
    }//  w  w w .j  a v  a 2s. c  om

    int filePosi = filePath.lastIndexOf(File.separator);
    return (filePosi == -1) ? "" : filePath.substring(0, filePosi + 1);
}

From source file:Main.java

public static String getFolderName(String filePath) {
    if (filePath == null || filePath.length() == 0 || filePath.trim().length() == 0) {
        return filePath;
    }//ww  w  . j  a v  a 2 s .c om
    int filePos = filePath.lastIndexOf(File.separator);
    return (filePos == -1) ? "" : filePath.substring(0, filePos);
}

From source file:Main.java

public static File fromAppPath(String appPath) {
    String[] terms = appPath.split(File.separator);
    if (terms == null || terms.length < 1) {
        return null;
    }/* ww w.  jav a 2  s . co  m*/
    File f = new File(new File(getOdkFolder()), appPath);
    return f;
}

From source file:Main.java

public static File getFinancistoBackupFolder() {
    return new File(Environment.getExternalStorageDirectory() + File.separator + "financisto");
}

From source file:ch.unibas.fittingwizard.infrastructure.base.ResourceUtils.java

public static String getRelativePath(File targetPath, File basePath) {
    return getRelativePath(targetPath.getAbsolutePath(), basePath.getAbsolutePath(), File.separator);
}

From source file:Main.java

/**
 * Play video file from res folder./*w  w  w . ja  v a2s.  c  om*/
 * Then call video.start();
 * @param activity - current Activity
 * @param videoViewId R.id.introVideo
 * @param videoResourceId R.raw.intro - res/raw/intro.mp4
 * @return VideoView
 */
public static VideoView playVideo(Activity activity, int videoViewId, int videoResourceId,
        MediaPlayer.OnCompletionListener listener) {
    activity.getWindow().setFormat(PixelFormat.TRANSLUCENT);
    VideoView view = (VideoView) activity.findViewById(videoViewId);
    view.setVideoURI(
            Uri.parse("android.resource://" + activity.getPackageName() + File.separator + videoResourceId));
    view.setKeepScreenOn(true);
    view.setMediaController(null);
    view.setOnCompletionListener(listener);
    view.requestFocus();
    return view;
}

From source file:ZipFileUtil.java

/**
 * @param zipFile/*from  w  w  w  .  ja v a2 s  .c  o  m*/
 * @param jiniHomeParentDir
 */
public static void unzipFileIntoDirectory(ZipFile zipFile, File jiniHomeParentDir) {
    Enumeration files = zipFile.entries();
    File f = null;
    FileOutputStream fos = null;

    while (files.hasMoreElements()) {
        try {
            ZipEntry entry = (ZipEntry) files.nextElement();
            InputStream eis = zipFile.getInputStream(entry);
            byte[] buffer = new byte[1024];
            int bytesRead = 0;

            f = new File(jiniHomeParentDir.getAbsolutePath() + File.separator + entry.getName());

            if (entry.isDirectory()) {
                f.mkdirs();
                continue;
            } else {
                f.getParentFile().mkdirs();
                f.createNewFile();
            }

            fos = new FileOutputStream(f);

            while ((bytesRead = eis.read(buffer)) != -1) {
                fos.write(buffer, 0, bytesRead);
            }
        } catch (IOException e) {
            e.printStackTrace();
            continue;
        } finally {
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException e) {
                    // ignore
                }
            }
        }
    }
}

From source file:invio.util.ArquivoUtil.java

public static String contextPath(String fileName) {
    FacesContext context = FacesContext.getCurrentInstance();
    ExternalContext external = context.getExternalContext();
    String path = external.getRealPath("/resources/arquivos" + File.separator + fileName);
    return path;//from w w  w.ja  v  a 2  s . c  o  m
}

From source file:Main.java

public static String getBootImagePath(String romId) {
    return Environment.getExternalStorageDirectory() + File.separator + "MultiBoot" + File.separator + romId
            + File.separator + "boot.img";
}