Package at.bestsolution.efxclipse.formats.svg

Source Code of at.bestsolution.efxclipse.formats.svg.SVGToFXML

/*******************************************************************************
* Copyright (c) 2012 BestSolution.at and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
*******************************************************************************/
package at.bestsolution.efxclipse.formats.svg;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import at.bestsolution.efxclipse.formats.svg.converter.FXMLConverter;
import at.bestsolution.efxclipse.formats.svg.handler.XMLLoader;
import at.bestsolution.efxclipse.formats.svg.svg.SvgSvgElement;

public class SVGToFXML {

  public static void main(String[] args) throws IOException {
    String fromFile = args[0];
    String toFile = args[1];
   
    InputStream in;
    if( fromFile.startsWith("http") ) {
      URL url = new URL(fromFile);
      in = url.openStream();
    } else {
      File f = new File(fromFile);
      in = new FileInputStream(f);
    }
   
    File outFile = new File(toFile);
   
    XMLLoader l = new XMLLoader();
    SvgSvgElement svgRoot = l.loadDocument(outFile.getAbsolutePath(), in);
    FXMLConverter converter = new FXMLConverter(svgRoot);
    FileOutputStream out = new FileOutputStream(outFile);
    out.write(converter.generate().toString().getBytes());
    out.close();
  }

}
TOP

Related Classes of at.bestsolution.efxclipse.formats.svg.SVGToFXML

TOP
Copyright © 2018 www.massapi.com. 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.