code: private static void writeItems(final Collection<Item> itemCollection,
              final DataOutput dos, final boolean dotted) throws IOException {
          int size = itemCollection.size();
          Item[] items = itemCollection.toArray(new Item[size]);
          Arrays.sort(items);
          for (int i = 0; i < size; i++) {
              dos.writeUTF(items[i].name);
              dos.writeInt(items[i].access);
              dos.writeUTF(dotted ? items[i].desc.replace('/', '.')
                      : items[i].desc);
          }
      }
docs: Sorts the items in the collection and writes it to the data output stream
  
  @param itemCollection
  collection of items
  @param dos
  a <code>DataOutputStream</code> value
  @param dotted
  a <code>boolean</code> value
  @exception IOException
  if an error occurs