code: public static void serializeToDisk( File file, Object obj ) throws IOException {
          byte[] serializedObj = serialize(obj);
          try (RandomAccessFile raFile = new RandomAccessFile(file, "rw")) {
              raFile.write(serializedObj);
          }
      }
docs: Serialize an object to disk.
  
  @param file
  the file to write to.
  @param obj
  the object to write.
  @throws IOException