Java Properties Load from File load(InputStream input)

Here you can find the source of load(InputStream input)

Description

load

License

Open Source License

Declaration

private static void load(InputStream input) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2004, 2010 IBM Corporation 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
 * //from ww  w  . j  ava  2 s.c om
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

import java.io.*;

import java.util.Dictionary;
import java.util.Properties;

import org.eclipse.osgi.util.ManifestElement;

public class Main {
    static private String[] devDefaultClasspath;
    static private Dictionary<String, String> devProperties = null;

    private static void load(InputStream input) {
        Properties props = new Properties();
        try {
            props.load(input);
        } catch (IOException e) {
            // TODO consider logging here
        } finally {
            if (input != null)
                try {
                    input.close();
                } catch (IOException e) {
                    // tried our best
                }
        }
        @SuppressWarnings({ "unchecked", "rawtypes" })
        Dictionary<String, String> result = (Dictionary) props;
        devProperties = result;
        if (devProperties != null)
            devDefaultClasspath = getArrayFromList(devProperties.get("*")); //$NON-NLS-1$
    }

    /**
     * Returns the result of converting a list of comma-separated tokens into an array
     * 
     * @return the array of string tokens
     * @param prop the initial comma-separated string
     */
    public static String[] getArrayFromList(String prop) {
        return ManifestElement.getArrayFromList(prop, ","); //$NON-NLS-1$
    }
}

Related

  1. load(File propertiesFile)
  2. load(final Class key, final String env, final Properties defaults)
  3. load(final Properties props, final Properties toLoad)
  4. load(final String folder, final String fileName)
  5. load(InputStream in)
  6. load(InputStream inputStream)
  7. load(InputStream is)
  8. load(InputStream stream)
  9. load(Map map, String fileName)