public void writeWatchableObjects(DataOutput par1DataOutput) throws IOException {
    this.lock.readLock().lock();
    Iterator iterator = this.watchedObjects.values().iterator();

    while (iterator.hasNext()) {
      WatchableObject watchableobject = (WatchableObject) iterator.next();
      writeWatchableObject(par1DataOutput, watchableobject);
    }

    this.lock.readLock().unlock();
    par1DataOutput.writeByte(127);
  }
  /** writes every object in passed list to dataoutputstream, terminated by 0x7F */
  public static void writeObjectsInListToStream(List par0List, DataOutput par1DataOutput)
      throws IOException {
    if (par0List != null) {
      Iterator iterator = par0List.iterator();

      while (iterator.hasNext()) {
        WatchableObject watchableobject = (WatchableObject) iterator.next();
        writeWatchableObject(par1DataOutput, watchableobject);
      }
    }

    par1DataOutput.writeByte(127);
  }