Beispiel #1
0
  /**
   * Deserialize from string
   *
   * @param s string to deserialize
   * @return Bookmark from string representation of this object
   */
  public static Bookmark fromStringRepresentation(String s) {
    MyStringTokenizer myst = new MyStringTokenizer(s, ":"); // $NON-NLS-1$
    if (myst.countTokens() != 7) {
      return null;
    }

    String versionName = Util.unescape(myst.nextToken());
    String bibleLocation = Util.unescape(myst.nextToken());
    String bookname = Util.unescape(myst.nextToken());
    String booknumber_s = myst.nextToken();
    String chapter_s = myst.nextToken();
    String verse_s = myst.nextToken();

    int booknumber = 0;
    int chapter = 0;
    int verse = 0;

    try {
      booknumber = Integer.parseInt(booknumber_s);
      chapter = Integer.parseInt(chapter_s);
      verse = Integer.parseInt(verse_s);
    } catch (NumberFormatException e) {
      return null;
    }

    String excerpt = Util.unescape(myst.nextToken());

    return new Bookmark(versionName, bibleLocation, bookname, booknumber, chapter, verse, excerpt);
  }
Beispiel #2
0
 public MXRecord(Name _name, short _dclass, int _ttl, MyStringTokenizer st, Name origin)
     throws IOException {
   super(_name, Type.MX, _dclass, _ttl);
   priority = Short.parseShort(st.nextToken());
   target = new Name(st.nextToken(), origin);
 }
Beispiel #3
0
 public NS_CNAME_PTRRecord(
     Name _name, short _type, short _dclass, int _ttl, MyStringTokenizer st, Name origin)
     throws IOException {
   super(_name, _type, _dclass, _ttl);
   target = new Name(st.nextToken(), origin);
 }