1 20 package org.openi.util; 21 22 import java.io.*; 23 import java.util.StringTokenizer ; 24 25 26 32 public class Util { 33 public Util() { 34 } 35 36 43 public static boolean isItemInList(String item, String items) { 44 if ((item == null) || (items == null)) { 45 return false; 46 } 47 48 StringTokenizer tokenizer = new StringTokenizer (items, ","); 49 50 while (tokenizer.hasMoreTokens()) { 51 if (item.equalsIgnoreCase(tokenizer.nextToken().trim())) { 52 return true; 53 } 54 } 55 56 return false; 57 } 58 59 66 static public String getFileContents(String fileNamePath) throws 67 FileNotFoundException, IOException { 68 StringBuffer buffer = new StringBuffer (); 69 BufferedReader input = new BufferedReader(new InputStreamReader(new 70 FileInputStream(fileNamePath))); 71 while (input.ready()) { 72 buffer.append(input.readLine()); 73 buffer.append("\r\n"); 74 } 75 return buffer.toString(); 76 } 77 } 78 | Popular Tags |