new XMLEncoder(OutputStream out) : XMLEncoder « java.beans « Java by API






new XMLEncoder(OutputStream out)

  


import java.beans.XMLEncoder;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;

import javax.swing.JFrame;

public class Main {
  public static void main(String args[]) {
    JFrame x = new JFrame("Look at me");
    x.setSize(200, 300);
    x.setVisible(true);
    x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    FileOutputStream f;
    try {
      f = new FileOutputStream("Test.xml");
      XMLEncoder e = new XMLEncoder(new BufferedOutputStream(f));
      e.writeObject(x);
      e.close();
    } catch (Exception e) {
    }
  }
}

   
    
  








Related examples in the same category

1.Encoder: setPersistenceDelegate(Class type, PersistenceDelegate persistenceDelegate)
2.XMLEncoder: writeObject(Object o)