code: public void writeWithType(Writable w, DataOutput dataOutput) throws IOException {
          w.writeType(dataOutput);
          w.write(dataOutput);
      }
docs: A convenience method for writing a given Writable  object to a DataOutput. The key is 1st written (a single short)
  followed by the value from writable.
  
  @param w          Writable value
  @param dataOutput DataOutput to write both key and value to
  @throws IOException If an error occurs during writing to the DataOutput