Jsp Translate Java
From Fxp Wiki
import java.io.IOException; import java.io.*; import java.io.Writer; import java.io.File; public String translate(String dirName) { StringBuffer output = new StringBuffer(); String monresult=""; String message=""; try { File dirObj = new File (dirName); if (dirObj.exists() == true) { if (dirObj.isDirectory() == true) { // Create an array of File objects, one for each file or directory in dirObj. File [] fileList = dirObj.listFiles(); // Display Source Directory Name. output.append("Source Directory: "+dirName); // Loop through File array and display. for (int i = 0; i < fileList.length; i++) { // Print the path to each file. output.append (fileList[i].getPath()); } // for loop } else { output.append (dirName+" is not a directory."); } } else { output.append ("Directory "+dirName+" does not exist."); } monresult = output.toString(); } catch(Exception e){} return monresult; }
Categories: Jspwiki | Wikis | Java | Source Code
