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 ) ; } }
Sorts the items in the collection and writes it to the data output stream