Ejemplo n.º 1
0
 @Override
 public boolean unserialize(final ByteBuffer buffer) {
   final int gems_size = buffer.getShort() & 0xFFFF;
   this.gems.clear();
   this.gems.ensureCapacity(gems_size);
   for (int i = 0; i < gems_size; ++i) {
     final Content gems_element = new Content();
     final boolean gems_element_ok = gems_element.unserialize(buffer);
     if (!gems_element_ok) {
       return false;
     }
     this.gems.add(gems_element);
   }
   return true;
 }
 @Override
 public boolean unserialize(final ByteBuffer buffer) {
   final int contents_size = buffer.getShort() & 0xFFFF;
   this.contents.clear();
   this.contents.ensureCapacity(contents_size);
   for (int i = 0; i < contents_size; ++i) {
     final Content contents_element = new Content();
     final boolean contents_element_ok = contents_element.unserialize(buffer);
     if (!contents_element_ok) {
       return false;
     }
     this.contents.add(contents_element);
   }
   final boolean contentsSelection_present = buffer.get() == 1;
   if (contentsSelection_present) {
     this.contentsSelection = new ContentsSelection();
     final boolean contentsSelection_ok = this.contentsSelection.unserialize(buffer);
     if (!contentsSelection_ok) {
       return false;
     }
   } else {
     this.contentsSelection = null;
   }
   final int buyableContents_size = buffer.getShort() & 0xFFFF;
   this.buyableContents.clear();
   this.buyableContents.ensureCapacity(buyableContents_size);
   for (int j = 0; j < buyableContents_size; ++j) {
     final BuyableContent buyableContents_element = new BuyableContent();
     final boolean buyableContents_element_ok = buyableContents_element.unserialize(buffer);
     if (!buyableContents_element_ok) {
       return false;
     }
     this.buyableContents.add(buyableContents_element);
   }
   return true;
 }