Package com.thoughtworks.xstream.io.xml

Examples of com.thoughtworks.xstream.io.xml.XppDriver


    public static TerrainAttributes loadFile(String fileName) {
       
        if (!cache.containsKey(fileName)) {
            try {
                TerrainAttributes terrain = (TerrainAttributes) (new XStream(
                        new XppDriver()).fromXML(Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)));
                terrain.load();
                cache.put(fileName, terrain);
            } catch (Exception e) {
                e.printStackTrace();
            }
View Full Code Here


       
        if(button == loadButton) {
            int result = getParametersJFC().showOpenDialog(null);
            if(result == JFileChooser.APPROVE_OPTION) {
                try {
                    params = (Parameters) new XStream(new XppDriver()).fromXML(new FileReader(getParametersJFC().getSelectedFile()));
                    updateDataToUI();
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            }
        } else if(button == saveButton) {
            int result = getParametersJFC().showSaveDialog(null);
            if(result == JFileChooser.APPROVE_OPTION) {
                try {
                    updateUIToData();
                    new XStream(new XppDriver()).toXML(params, new FileWriter(getTerrainJFC().getSelectedFile()));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        } else if(button == loadTerrainButton) {
View Full Code Here

    /*
     * create a driver that wires into a standard driver, and updates the stack
     * position.
     */
    HierarchicalStreamDriver driver = new StackDriver(new XppDriver(), writerStack, configuration.getNameSpaces());
    /*
     * Create an interface class mapper that understands class hierarchy for
     * single items
     */
    for (XStreamConfiguration.ConverterSet c : MAPPER_SCOPES) {
View Full Code Here

      {
         xstream_ = SecurityHelper.doPrivilegedAction(new PrivilegedAction<XStream>()
         {
            public XStream run()
            {
               return new XStream(new XppDriver());
            }
         });
         xstream_.alias("user-profile", UserProfileImpl.class);
      }
      return xstream_;
View Full Code Here

                public XMLOutputFactory getOutputFactory() {
                   return outf;
                }
            });
        } else {
            xstream = new XStream(new XppDriver(){
                public HierarchicalStreamWriter createWriter(Writer out) {
                    //return new PrettyPrintWriter(out, xmlFriendlyReplacer());
                    return new CompactWriter(out, xmlFriendlyReplacer());
                }
            });
View Full Code Here

     * @since 1.2
     * @see #toXML(XStream, Object, Writer)
     */
    public Object fromXML(Reader xml)
            throws IOException, ClassNotFoundException {
        return fromXML(new XppDriver(), xml);
    }
View Full Code Here

     * match for the {@link ReflectionProvider} on its own.
     *
     * @throws InitializationException in case of an initialization problem
     */
    public XStream() {
        this(null, (Mapper)null, new XppDriver());
    }
View Full Code Here

     * Constructs an XStream with a special {@link ReflectionProvider}. The instance will use the {@link XppDriver} as default.
     *
     * @throws InitializationException in case of an initialization problem
     */
    public XStream(ReflectionProvider reflectionProvider) {
        this(reflectionProvider, (Mapper)null, new XppDriver());
    }
View Full Code Here

  public synchronized static void saveSampleResult(SampleEvent evt, Writer writer) throws IOException {
    DataHolder dh = saver.newDataHolder();
    dh.put(SAMPLE_EVENT_OBJECT, evt);
    // This is effectively the same as saver.toXML(Object, Writer) except we get to provide the DataHolder
    // Don't know why there is no method for this in the XStream class
    saver.marshal(evt.getResult(), new XppDriver().createWriter(writer), dh);
    writer.write('\n');
  }
View Full Code Here

    /*
     * create a driver that wires into a standard driver, and updates the stack
     * position.
     */
    HierarchicalStreamDriver driver = new StackDriver(new XppDriver(), writerStack, configuration.getNameSpaces());
    /*
     * Create an interface class mapper that understands class hierarchy for
     * single items
     */
    for (XStreamConfiguration.ConverterSet c : MAPPER_SCOPES) {
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.xml.XppDriver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.