1 25 26 package net.killingar.forum.internal; 27 28 import java.util.HashMap ; 29 import java.util.Map ; 30 import java.util.regex.Pattern ; 31 32 public class PropertyData 33 { 34 static final Pattern p1 = Pattern.compile("[\n\r]"); 35 static final Pattern p2 = Pattern.compile("="); 36 Map fields = new HashMap (); 37 38 public PropertyData(String in) 39 { 40 String [] values = p1.split(in); 41 for (int i = 0; i != values.length; i++) 42 { 43 String [] v2 = p2.split(values[i]); 44 45 if (v2.length > 1) 46 fields.put(v2[0], v2[1]); 47 } 48 } 49 50 public Map getFields() { return fields; } 51 52 public String getParam(String in) 53 { 54 return (String )fields.get(in); 55 } 56 57 public String toString() 58 { 59 return fields.toString(); 60 } 61 62 public int getSize() 63 { 64 return fields.size(); 65 } 66 } 67 68 | Popular Tags |