Package com.microstar.xml.demo

Source Code of com.microstar.xml.demo.StreamDemo

// StreamDemo.java: demonstration application showing Æfred's event stream.
// NO WARRANTY! See README, and copyright below.
// $Id: StreamDemo.java,v 1.10 2005/07/08 19:54:43 cxh Exp $
// Modified 11/8/98 to add package statement.
package com.microstar.xml.demo;

import java.io.FileInputStream;
import java.io.InputStream;

import com.microstar.xml.XmlParser;

/**
* Demonstration application showing Æfred's event stream from a stream.
* <p>Usage: <code>java StreamDemo</code>
* @author Copyright (c) 1998 by Microstar Software Ltd.;
* @author written by David Megginson &lt;dmeggins@microstar.com&gt;
* @version 1.1
* @since Ptolemy II 0.2
* @see com.microstar.xml.XmlParser
* @see com.microstar.xml.XmlHandler
* @see XmlApp
* @see EventDemo
*/
public class StreamDemo extends EventDemo {
    public static void main(String[] args) throws Exception {
        StreamDemo handler = new StreamDemo();
        InputStream is = null;

        if (args.length != 1) {
            System.err.println("Usage: java StreamDemo <file>");
            System.exit(1);
        }

        try {
            is = new FileInputStream(args[0]);

            XmlParser parser = new XmlParser();
            parser.setHandler(handler);
            parser.parse(makeAbsoluteURL(args[0]), null, is, null);
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (Throwable throwable) {
                    System.out.println("Failed to close '" + args[0] + "'");
                    throwable.printStackTrace();
                }
            }
        }
    }
}
TOP

Related Classes of com.microstar.xml.demo.StreamDemo

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.