예제 #1
0
  /**
   * Create a new client info.
   *
   * <p>A client info is needed for initial setup of a {@link Connection}. Later, when the user
   * decides to change one of the values given here as parameters, a new client info should be send
   * to the server using {@link Connection#send(ClientInfo)}.
   *
   * @param imgSize preferred size of images (cover art) for this client device
   * @param imgType preferred type of images (cover art) for this client device (one of {@link
   *     #IMG_TYPE_JPEG} or {@link #IMG_TYPE_PNG})
   * @param ilPageSize preferred maximum length of item list pages for this client device (when
   *     browsing a player's media library, track lists may be very long and exceed capabilities of
   *     client devices - this value is used to split media library track lists into multiple pages)
   * @param extra optional extra information as a string hash table (used by the tool
   *     <em>remuco-report</em>) - this is only useful for an initial client info and may be <code>
   *     null</code> when sending an updated client info to the server
   */
  public ClientInfo(int imgSize, String imgType, int ilPageSize, Hashtable extra) {

    atoms = SerialAtom.build(ATOMS_FMT);

    atoms[0].i = imgSize;
    atoms[1].s = imgType;
    atoms[2].i = ilPageSize;

    if (extra != null) {

      extra.put("version", VERSION);

      atoms[3].as = new String[extra.size()];
      atoms[4].as = new String[extra.size()];

      final Enumeration enu = extra.keys();
      int i = 0;
      while (enu.hasMoreElements()) {
        final String key = (String) enu.nextElement();
        final String val = (String) extra.get(key);
        atoms[3].as[i] = key;
        atoms[4].as[i] = val;
        i++;
      }
    }
  }
예제 #2
0
파일: Item.java 프로젝트: gzsombor/remuco
  /**
   * Create a new item with ID {@link #ID_NONE} and title {@link #META_TITLE_VALUE_NONE}.
   *
   * <p>Whenever this item gets updated as a result of deserialization (see {@link
   * #notifyAtomsUpdated()}), ID and title get set to the values above fi they are missing in the
   * deserialized data.
   */
  public Item() {

    atoms = SerialAtom.build(ATOMS_FMT);

    meta = new Hashtable(10);

    setMeta(META_TITLE, META_TITLE_VALUE_NONE);
  }