List of usage examples for java.util Hashtable Hashtable
Hashtable(Void dummy)
From source file:Main.java
public static Hashtable<String, Element> getChildHash(Element elem, String elementName, String attrName) { if (elem == null) return null; NodeList nl = elem.getChildNodes(); if (nl == null) return null; Hashtable<String, Element> retlist = new Hashtable<String, Element>(100); for (int n = 0; n < nl.getLength(); n++) { Node child = nl.item(n);//from w ww . j av a 2 s . c o m if (child instanceof Element) { Element element = (Element) child; if (!elementName.equals(element.getTagName())) continue; String keyValue = element.getAttribute(attrName); if (keyValue == null) continue; retlist.put(keyValue, element); } } if (retlist.size() == 0) return null; return retlist; }
From source file:Main.java
public static <K, V> Hashtable<K, V> newHashtable(final int initialCapacity) { return new Hashtable<K, V>(initialCapacity); }
From source file:Main.java
public static Hashtable<String, String> errorCodes() { Hashtable<String, String> errors = new Hashtable<String, String>(13); errors.put("ERR1", "Invalid data format and/or syntax!"); errors.put("ERR2", "No data was sent!"); errors.put("ERR3", "Invalid Command Sent!"); errors.put("ERR4", "Missing/Empty Command Argument(s) Recvd."); errors.put("ERR5", "Invalid command syntax!"); errors.put("ERR6", "Invalid Auth Syntax!"); errors.put("ERR7", "Access Denied!"); errors.put("ERR8", "Server Timeout, Too Busy to Handle Request!"); errors.put("ERR9", "Unknown Data Transmission Error"); errors.put("ERR10", "Auth required."); errors.put("ERR11", "Invalid Auth."); errors.put("ERR12", "Not logged in."); errors.put("ERR13", "Incorrect Username/Password!"); errors.put("ERR14", "Invalid Login Command Syntax."); errors.put("ERR19", "Unknown Auth Error"); return errors; }
From source file:Main.java
/** * Method getHashtableFromVector./* www . jav a2 s . c o m*/ * @param vector Vector * @param keyGetter String * @return Hashtable * @throws NoSuchMethodException * @throws InvocationTargetException * @throws IllegalAccessException */ public static Hashtable getHashtableFromVector(Vector vector, String keyGetter) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Hashtable hashtable = new Hashtable(vector.size()); Object vectorElement = null; Object keyObject = null; Method keyGetterMethod = null; Class[] clsParms = new Class[0]; Object[] objParms = new Object[0]; for (int i = 0; i < vector.size(); i++) { vectorElement = vector.elementAt(i); keyGetterMethod = vectorElement.getClass().getMethod(keyGetter, clsParms); keyObject = keyGetterMethod.invoke(vectorElement, objParms); hashtable.put(keyObject, vectorElement); } return hashtable; }
From source file:Main.java
public static Hashtable<String, String> errorCodes() { Hashtable<String, String> errors = new Hashtable<String, String>(13); errors.put("ERR1", "Invalid data and/or request syntax!"); errors.put("ERR2", "Invalid data, possible missing data separator."); errors.put("ERR3", "Invalid data/syntax, could not parse data."); errors.put("ERR4", "Missing/Empty Command Argument(s) Recvd."); errors.put("ERR5", "Invalid command syntax!"); errors.put("ERR6", "Invalid Auth Syntax!"); errors.put("ERR7", "Access Denied!"); errors.put("ERR8", "Server Timeout, Too Busy to Handle Request!"); errors.put("ERR9", "Incorrect Password."); errors.put("ERR14", "Invalid Login Command Syntax."); errors.put("ERR19", "Unknown Auth Error"); errors.put("ERR99", "Unknown exception occured."); errors.put("ERR100", "Invalid Host/IP."); errors.put("ERR101", "Cannont connect to server."); return errors; }
From source file:Main.java
public static Hashtable<String, String> errorCodes() { Hashtable<String, String> errors = new Hashtable<String, String>(13); errors.put("ERR1", "Invalid, null or missing data was passed by the client! (ErrCode=1)"); errors.put("ERR2", "Invalid or missing data separator in client data. (ErrCode=2"); errors.put("ERR3", "Data not formatted properly for the parser. Possible command/syntax mismatch. (ErrCode=3)"); errors.put("ERR4", "Cient passed no discernable data. Possibly null. (ErrCode=4)"); errors.put("ERR5", "Parsing Failed!! Client passed non-parsable data. No parameters/data-blocks were found, looks like data, really just gibberish. (ErrCode=5)"); errors.put("ERR6", "Authentication: Invalid, missing or garbled command syntax! (ErrCode=6)"); errors.put("ERR7", "Access to server denied! Reason: Server may be deactivated or have too many clients. (ErrCode=7)"); errors.put("ERR8", "Authentication: IO exception occured while communicating with the server. (ErrCode=8)"); errors.put("ERR9", "Invalid password was passed by the client, double check and try again. (ErrCode=9)"); errors.put("ERR20", "SendBarcode: Received invalid, garbled or unknown response from server. (ErrCode=20)"); errors.put("ERR21", "SendBarcode: Unknown exception occured while communicating with the server. (ErrCode=20)"); errors.put("ERR99", "General Unknown exception has occured. (ErrCode=99)"); errors.put("ERR50", "Invalid Host/IP. (ErrCode=50)"); errors.put("ERR51", "Cannont connect to server. (ErrCode=51)"); errors.put("ERR52", "Server Timeout, Too busy to handle request! (ErrCode=52)"); errors.put("ERR101", "Server encountered an unknown error when attempting to 'type' the barcode. (ErrCode=101)"); return errors; }
From source file:HTMLEncode.java
protected static synchronized void buildEntityTables() { entityTableEncode = new Hashtable(ENTITIES.length); for (int i = 0; i < ENTITIES.length; i += 2) { if (!entityTableEncode.containsKey(ENTITIES[i])) { entityTableEncode.put(ENTITIES[i], ENTITIES[i + 1]); }/*from ww w . j a va 2 s.c om*/ } }
From source file:Main.java
public static <K, V> Hashtable<K, V> newHashtable(final Map<? extends K, ? extends V> m) { return new Hashtable<K, V>(m); }
From source file:com.emobtech.facebook.api.graph.Friends.java
/** * <p>//from w w w. j a v a2 s.co m * Parses the JSON content. * </p> * @param json Content; * @return Array of data. * @throws JSONException If any error occurs during parsing. */ private static Hashtable[] parseJSON(String json) throws JSONException { JSONObject jo = new JSONObject(json); JSONArray ja = jo.getJSONArray("data"); Hashtable[] fa = new Hashtable[ja.length()]; // for (int i = 0; i < fa.length; i++) { jo = (JSONObject) ja.get(i); Hashtable fo = new Hashtable(2); // fo.put("id", jo.get("id")); fo.put("name", jo.get("name")); // fa[i] = fo; } // return fa; }
From source file:Main.java
public static Hashtable<String, String> getChildHash(Element elem) { if (elem == null) return null; NodeList nl = elem.getChildNodes(); if (nl == null) return null; Hashtable<String, String> retlist = new Hashtable<String, String>(nl.getLength()); for (int n = 0; n < nl.getLength(); n++) { Node child = nl.item(n);/*from ww w .j av a 2 s.c om*/ if (child instanceof Element) { Element element = (Element) child; String key = element.getTagName(); String value = getSimpleElementText(element); retlist.put(key, value); } } if (retlist.size() == 0) return null; return retlist; }