Java Properties Load loadPropertiesFromString(String propertiesString)

Here you can find the source of loadPropertiesFromString(String propertiesString)

Description

Load properties from a string.

License

Open Source License

Parameter

Parameter Description
propertiesString String containing properties to read.

Exception

Parameter Description
IOException if properties cannot be read from string.

Return

Properties object with keys and values as read from properties string.

Declaration


public static Properties loadPropertiesFromString(String propertiesString) throws IOException 

Method Source Code


//package com.java2s;
/*   Please see the license information at the end of this file. */

import java.io.*;

import java.util.*;

public class Main {
    /**   Load properties from a string.
     */*from www  . j  a va 2s .  co  m*/
    *   @param   propertiesString   String containing properties to read.
    *
    *   @return   Properties object with keys and values as read from
    *         properties string.
    *
    *   @throws   IOException if properties cannot be read from string.
     */

    public static Properties loadPropertiesFromString(String propertiesString) throws IOException {
        Properties properties = new Properties();

        properties.load(new ByteArrayInputStream(propertiesString.getBytes("ISO-8859-1")));

        return properties;
    }
}

Related

  1. loadProperties(String resourceName)
  2. loadProperties(String resourceName, ClassLoader classLoader)
  3. loadPropertiesFromResource(ClassLoader clsLoader, String resourcePath)
  4. loadPropertiesFromResource(String name)
  5. loadPropertiesFromResources(Class cls, String[] resources)
  6. loadPropertiesResources(String name)
  7. loadSystemPropertiesFromPropertiesResource(String propertiesResourceName)