Code example for StringWriter

Methods: getBuffertoString

0
       
   } 
 
   public void test32() throws Exception{ 
      Serializer s = new Persister();
      StringWriter sw = new StringWriter();
      s.write(new Test3_2(new MyElementA(), new MyElementB()), sw);     
      String serializedForm = sw.toString();
      System.out.println(serializedForm);
      System.out.println();
      Test3_2 o = s.read(Test3_2.class, serializedForm);
      sw.getBuffer().setLength(0);
      s.write(o, sw);
      System.out.println(sw.toString());
      System.out.println();
   } 
    
   public void test33() throws Exception{ 
      Serializer s = new Persister();
      StringWriter sw = new StringWriter();
Connect your IDE to all the code out there  Get Codota for Java