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.iggroup.oss.restdoclet.plugin.io.IOUtils.java

/**
 * Copies a <i>large</i> input-file to an output-stream.
 * //from  w w w. j a v a  2 s .  c o m
 * @param input the <i>large</i> input-stream.
 * @param output the output-stream.
 * @param close <code>true</code> if the output-stream has to be closed
 *           after copying, <code>false</code> otherwise.
 * @throws IOException if an input-output exception occurs.
 */
public static void copyLarge(final File input, final File output, final boolean close) throws IOException {
    LOG.debug("Copying " + output.toString());
    copyLarge(new FileInputStream(input), new FileOutputStream(output), close);
}

From source file:Main.java

public static String getSDPath() {
    File sdDir = null;
    boolean sdCardExist = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    if (sdCardExist) {
        sdDir = Environment.getExternalStorageDirectory();
    }/*from ww w  .ja va2 s .c om*/
    String dir = sdDir.toString();
    return dir;
}

From source file:Main.java

/**
 * Checks whether the filename looks legitimate
 *///from  w ww  . j a  v a 2s .c o m
static boolean isFilenameValid(String filename, File downloadsDataDir) {
    filename = filename.replaceFirst("/+", "/"); // normalize leading slashes
    return filename.startsWith(Environment.getDownloadCacheDirectory().toString())
            || filename.startsWith(downloadsDataDir.toString())
            || filename.startsWith(Environment.getExternalStorageDirectory().toString());
}

From source file:Main.java

public static String getSDPath() {
    File sdDir = null;
    boolean sdCardExist = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    if (sdCardExist) {
        sdDir = Environment.getExternalStorageDirectory(); // get root path
        return sdDir.toString();
    }/*w w  w.ja  va2s .  com*/
    return null;
}

From source file:Main.java

@SuppressLint("SdCardPath")
public static String getSDPath() {
    File sdDir = null;
    boolean sdCardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
    if (sdCardExist) {
        sdDir = Environment.getExternalStorageDirectory();
    }// w  w w.ja  v  a 2s  . c  o  m
    return sdDir.toString();
}

From source file:com.textocat.textokit.morph.opencorpora.resource.DictionaryDeserializer.java

public static MorphDictionaryImpl from(File file) throws Exception {
    if (!file.isFile()) {
        throw new IllegalArgumentException(String.format("%s is not existing file", file));
    }//from   w  ww  .  j a  va  2 s .  co  m
    return from(new FileInputStream(file), file.toString());
}

From source file:ch.elexis.importer.div.Helpers.java

static Path copyRscToTempDirectory() {
    Path path = null;/*w  w  w.  j  av a2  s. c  o  m*/
    try {
        path = Files.createTempDirectory("HL7_Test");
        File src = new File(PlatformHelper.getBasePath("ch.elexis.core.ui.importer.div.tests"), "rsc");
        System.out.println("src: " + src.toString());
        FileUtils.copyDirectory(src, path.toFile());
    } catch (IOException e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
    return path;
}

From source file:com.ibm.watson.developer_cloud.retrieve_and_rank.v1.util.ZipUtils.java

/**
 * Builds the configuration ZIP file.//from   ww  w  . j  a v a  2s  .  c  o m
 * 
 * @param configName the configuration name
 * @param parentDir the parent directory
 * @return the file
 */
public static File buildConfigZip(final String configName, final File parentDir) {
    if (!parentDir.isDirectory()) {
        throw new RuntimeException(MSGS.format(CONFIG_NOT_DIR_1, parentDir.toString()));
    }

    final File zipFile = createEmptyZipFile(configName);
    final ZipOutputStream out;
    try {
        out = new ZipOutputStream(new FileOutputStream(zipFile));
    } catch (final FileNotFoundException e) {
        throw new RuntimeException(MSGS.format(ERROR_ZIPPING_1, parentDir.toString()), e);
    }

    try {
        addFilesToZip(parentDir, out, parentDir);
        return zipFile;
    } catch (final IOException e) {
        throw new RuntimeException(MSGS.format(ERROR_ZIPPING_1, parentDir.toString()), e);
    } finally {
        try {
            if (out != null) {
                out.close();
            }
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
    }
}

From source file:filterviewplugin.FilterViewSettings.java

static String getIconDirectoryName() {
    File dir = new File(Plugin.getPluginManager().getTvBrowserSettings().getTvBrowserUserHome(), "filtericons");
    return dir.toString();
}

From source file:net.chunkyhosting.Roe.CHGManagerLauncher.utils.JSON.java

public static JSONObject readJsonFromFile(File file)
        throws FileNotFoundException, IOException, NullPointerException {

    String json = "NULL";
    BufferedReader reader = new BufferedReader(new FileReader(file.toString()));
    String read = "";
    while ((read = reader.readLine()) != null) {

        json = json + read;/*from   w ww . j a v a 2  s.  c o  m*/

    }

    reader.close();

    if (!json.equalsIgnoreCase("NULL")) {

        return stringToJson(json);

    }

    throw new NullPointerException();

}