Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * @(#)IOUtils.java
 *
 * $Date: 2012-07-03 01:10:05 -0500 (Tue, 03 Jul 2012) $
 *
 * Copyright (c) 2011 by Jeremy Wood.
 * All rights reserved.
 *
 * The copyright of this software is owned by Jeremy Wood. 
 * You may not use, copy or modify this software, except in  
 * accordance with the license agreement you entered into with  
 * Jeremy Wood. For details see accompanying license terms.
 * 
 * This software is probably, but not necessarily, discussed here:
 * http://javagraphics.java.net/
 * 
 * That site should also contain the most recent official version
 * of this software.  (See the SVN repository for more details.)
 */

import java.io.File;
import java.io.FileInputStream;

import java.io.IOException;
import java.io.InputStream;

import java.net.URL;
import java.util.Properties;

public class Main {
    /** Loads properties into a file.
     * <P>This assumes the file was written with the
     * <code>Properties.store()</code> method.
     */
    public static void load(Properties p, File file) throws IOException {
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            p.load(in);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (Throwable t) {
                }
            }
        }
    }

    /** Loads properties into a file.
     * <P>This assumes the file was written with the
     * <code>Properties.store()</code> method.
     */
    public static void load(Properties p, URL url) throws IOException {
        InputStream in = null;
        try {
            in = url.openStream();
            p.load(in);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (Throwable t) {
                }
            }
        }
    }
}