Here you can find the source of toFile(String path)
Parameter | Description |
---|---|
path | a parameter |
public static File toFile(String path)
//package com.java2s; //License from project: LGPL import java.io.File; public class Main { /**/*from w w w . j av a 2s . com*/ * Field <code>FILE_SEPERATOR</code> */ public static final char FILE_SEPERATOR = File.separatorChar; /** * Field <code>FILE_ANTI_SEPERATOR</code> */ public static final char FILE_ANTI_SEPERATOR = (FILE_SEPERATOR == '/') ? '\\' : '/'; /** * create a file from path * @param path * @return new File Object */ public static File toFile(String path) { return new File(path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR)); } /** * create a File from parent file and string * @param parent * @param path * @return new File Object */ public static File toFile(File parent, String path) { return new File(parent, path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR)); } /** * create a File from parent file and string * @param parent * @param path * @return new File Object */ public static File toFile(String parent, String path) { return new File(parent.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR), path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR)); } }