title: Java- Save object data to a file
body: <p>I've seen so many different posts about what way you're supposed to serialize an object to a file, and all of them conflict in nature on how to do it and what the best practices are.  So here's what I'm trying to save:</p>
  
  <pre><code>public class IHandler{
      public double currentLoad;
      public String currentPrice;
      public String configArgs[];
  };
  </code></pre>
  
  <p>We can assume that the size of configArgs is known that I need to make a file, here's what I have so far.  </p>
  
  <pre><code>public static void serializeDataOut(IHandler ISH)throws IOException{
      String fileName= "Test.txt";
      FileOutputStream fos = new FileOutputStream(fileName);
          //What do I do here?
      }
  
    public static IHandler serializeDataIn(){
        //What do I do here?
    }
  </code></pre>