Пример #1
0
 public long getLongContent(long defaultValue) {
   String c = node.getTextContent();
   if (c != null) {
     try {
       return Long.parseLong(c);
     } catch (NumberFormatException nfe) {
     }
   }
   return defaultValue;
 }
Пример #2
0
  public long getUnicodeAsLong() {
    long retval = -1;

    String s = getUnicodeAsString();
    if (s.equals("")) {
      return retval;
    } // if

    try {
      retval = Long.parseLong(s, 16);
    } catch (NumberFormatException e) {
      retval = -1;
    } // try-catch

    return retval;
  }
Пример #3
0
 /**
  * Returns the value of an attribute.
  *
  * @param name the non-null full name of the attribute.
  * @param defaultValue the default value of the attribute.
  * @return the value, or defaultValue if the attribute does not exist.
  */
 public long getLong(String name, long defaultValue) {
   String value = getString(name);
   return (value == null) ? defaultValue : Long.parseLong(value);
 }