View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package org.lsst.ccs.utilities.zonesui;
6   
7   import java.beans.XMLDecoder;
8   import java.io.BufferedInputStream;
9   import java.io.IOException;
10  import java.io.InputStream;
11  import java.io.OutputStream;
12  import java.util.ArrayList;
13  
14  /**
15   *
16   * @author Pascal Durieu
17   */
18  public class XMLStore {
19      public static ArrayList<Zone> readFromXML (InputStream is) throws IOException  {
20          XMLDecoder decoder =  new XMLDecoder(new BufferedInputStream(is)) ;
21          decoder.close();
22          ArrayList<ZoneXML> initialList = (ArrayList<ZoneXML>)decoder.readObject();
23          ArrayList<Zone> resList = new ArrayList<Zone>(initialList.size());
24          for (ZoneXML zx : initialList) {
25                  resList.add(new Zone(zx.getKey(),zx.getTipText(),zx.getShapeBean().genShape()));
26           }
27          return resList ;
28      } 
29      
30      public static void writeToXML(ArrayList<Zone> liste, OutputStream os) {
31          
32      }
33  }