Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * $Id: XMLParserUtilities.java,v 1.1 2004/03/25 18:41:32 edankert Exp $
 *
 * The contents of this file are subject to the Mozilla Public License 
 * Version 1.1 (the "License"); you may not use this file except in 
 * compliance with the License. You may obtain a copy of the License at 
 * http://www.mozilla.org/MPL/ 
 *
 * Software distributed under the License is distributed on an "AS IS" basis, 
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
 * for the specific language governing rights and limitations under the License.
 *
 * The Original Code is eXchaNGeR browser code. (org.xngr.browser.*)
 *
 * The Initial Developer of the Original Code is Cladonia Ltd.. Portions created 
 * by the Initial Developer are Copyright (C) 2002 the Initial Developer. 
 * All Rights Reserved. 
 *
 * Contributor(s): Dogsbay
 */

import java.io.IOException;
import java.io.Reader;

public class Main {
    private static final boolean DEBUG = false;

    public static String parseString(Reader reader, char delim) throws IOException {
        //      System.out.println("XMLParserUtilities.parseString( "+reader+", "+delim+")");
        StringBuffer buffer = new StringBuffer();

        char c = (char) reader.read();

        while (c != delim) {
            buffer.append(c);
            ;
            c = (char) reader.read();
        }

        String result = buffer.toString();

        if (DEBUG)
            System.out.println("XMLParserUtilities.parseString( " + reader + ", " + delim + ") [" + result + "]");

        return result;
    }
}