Ejemplo n.º 1
0
  public JsListStorage(String prefix, Storage storage) {
    this.storage = storage;
    this.prefix = prefix;

    String indexData = storage.getItem("list_" + prefix + "_index");
    if (indexData != null) {
      try {
        byte[] data = fromBase64(indexData);
        DataInput dataInput = new DataInput(data, 0, data.length);
        int count = dataInput.readInt();
        for (int i = 0; i < count; i++) {
          long id = dataInput.readLong();
          long order = dataInput.readLong();
          index.add(new Index(id, order));
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    updateIndex();
  }
 @Override
 protected void readBody(DataInput bs) throws IOException {
   messageId = bs.readLong();
   responseMessageId = bs.readLong();
   len = bs.readInt();
 }