Пример #1
0
 private void writePropertyBlock(PropertyBlock block) throws IOException {
   byte blockSize = (byte) block.getSize();
   assert blockSize > 0 : blockSize + " is not a valid block size value";
   channel.put(blockSize); // 1
   long[] propBlockValues = block.getValueBlocks();
   for (long propBlockValue : propBlockValues) {
     channel.putLong(propBlockValue);
   }
   /*
    * For each block we need to keep its dynamic record chain if
    * it is just created. Deleted dynamic records are in the property
    * record and dynamic records are never modified. Also, they are
    * assigned as a whole, so just checking the first should be enough.
    */
   if (block.isLight()) {
     /*
      *  This has to be int. If this record is not light
      *  then we have the number of DynamicRecords that follow,
      *  which is an int. We do not currently want/have a flag bit so
      *  we simplify by putting an int here always
      */
     channel.putInt(0); // 4 or
   } else {
     writeDynamicRecords(block.getValueRecords());
   }
 }