Loads properties from an input stream.

@since 1.0
@param input the input stream to read properties from
@return the properties
@throws IOException an error occurred while reading the properties
501339
public static Properties load(InputStream input) throws IOException {
		Properties prop = new Properties();
		try {
			prop.load(input);
		} catch (IOException e) {
			throw new IOException("Failed to read properties from input");
		}
		return prop;
	}
290387
public static Properties readPropertiesStream(InputStream inputStream) {
		try {
			final Properties prop = new Properties();
			// try to read in utf 8
			prop.load(new InputStreamReader(inputStream, Charset.forName("utf-8")));
			JKCollectionUtil.fixPropertiesKeys(prop);
			return prop;
		} catch (IOException e) {
			JKExceptionUtil.handle(e);
			return null;
		} finally {
			close(inputStream);
		}
	}
1222221
private Properties loadProperties(InputStream inputStream) throws IOException {
        Properties properties = new Properties();
        properties.load(inputStream);
        return properties;
    }
1292485
public static ExampleProperties loadProperties() throws IOException {
    String propsName = "Example.properties";

    try ( InputStream propsStream = openStream(propsName) ) {
      if (propsStream == null)
        throw new IOException("Could not read properties "+propsName);

      Properties props = new Properties();
      props.load(propsStream);

      return new ExampleProperties(props);
    }
  }
662695
public ISimpleChemObjectReader createReader(InputStream input) throws IOException {
        IChemFormat format = null;
        ISimpleChemObjectReader reader = null;
        if (input instanceof GZIPInputStream) {
            format = formatFactory.guessFormat(input);
            reader = createReader(format);
            if (reader != null) {
                try {
                    reader.setReader(input);
                } catch (CDKException e1) {
                    IOException wrapper = new IOException("Exception while setting the InputStream: " + e1.getMessage());
                    wrapper.initCause(e1);
                    throw wrapper;
                }
            }
        } else {
            BufferedInputStream bistream = new BufferedInputStream(input, headerLength);
            InputStream istreamToRead = bistream; // if gzip test fails, then take default
            bistream.mark(5);
            int countRead = 0;
            byte[] abMagic = new byte[4];
            countRead = bistream.read(abMagic, 0, 4);
            bistream.reset();
            if (countRead == 4) {
                if (abMagic[0] == (byte) 0x1F && abMagic[1] == (byte) 0x8B) {
                    istreamToRead = new BufferedInputStream(new GZIPInputStream(bistream));
                }
            }
            format = formatFactory.guessFormat(istreamToRead);
            reader = createReader(format);
            if (reader != null) {
                try {
                    reader.setReader(istreamToRead);
                } catch (CDKException e1) {
                    IOException wrapper = new IOException("Exception while setting the InputStream: " + e1.getMessage());
                    wrapper.initCause(e1);
                    throw wrapper;
                }
            }
        }
        return reader;
    }
182394
public static String read(InputStream input) {
		try {
			StringBuilder bld = new StringBuilder();
			Reader reader = new InputStreamReader(input, "utf-8");
			int ch;
			while ((ch = reader.read()) >= 0)
				bld.append((char)ch);
			
			return bld.toString();
		} catch (IOException ex) {
			throw new RuntimeException(ex);
		}
	}
781530
public static List<String> toLines(final Reader input) throws IOException {
		return CharStreams.readLines(toBufferedReader(input));
	}
726612
@Override
	public void load(final InputStream inStream) throws IOException {
		lock.writeLock().lock();
		try {
			properties.load(inStream);
		} finally {
			lock.writeLock().unlock();
		}
	}
759215
public static <T> InputReader getInstance(T input, int size, String cs) throws IOException
    {
        return getInstance(input, size, Charset.forName(cs), NO_FEATURES);
    }
347713
public static String readFileIntoString(URL input) throws IOException
   {

      InputStream stream = null;
      InputStreamReader reader = null;
      try
      {
         stream = input.openStream();
         reader = new InputStreamReader(stream);
         return readStreamIntoString(reader);
      }
      finally
      {
         if (reader != null)
            reader.close();
         if (stream != null)
            stream.close();
      }
   }
402869
public JsonReader newJsonReader( String input ) {
        JsonReader reader = new NonBufferedJsonReader( input );
        reader.setLenient( true );
        return reader;
    }
855063
public static BufferedImage readQuietly(final InputStream input)
	{
		BufferedImage img = null;
		try
		{
			img = ImageIO.read(input);
		}
		catch (IOException e)
		{
			log.log(Level.SEVERE, "Reading image failed.", e);
		}
		return img;
	}
466354
public static Map<String, Object> load(InputStream input) {
        Yaml yaml = new Yaml();
        Object rawYamlObj = yaml.load(input);
        @SuppressWarnings("unchecked")
        Map<String, Object> yamlObj = (Map<String, Object>) rawYamlObj;
        return yamlObj;
    }
879593
private InputStream propertiesInputStream() throws IOException {
        String propertiesFilePath = System.getProperty(PROPERTIES_FILE_PATH);
        URL propertiesFileUrl = null;
        if (propertiesFilePath != null) {
            try {
                propertiesFileUrl = new URL(propertiesFilePath);
            } catch (MalformedURLException ignore) {
                propertiesFileUrl = ClassLoaderUtils.getResource(propertiesFilePath);
                if (propertiesFileUrl == null) {
                    File f = new File(propertiesFilePath);
                    if (f.exists() && f.isFile()) {
                        try {
                            propertiesFileUrl = f.toURI().toURL();
                        } catch (MalformedURLException e) {
                            LOGGER.error("The property " + propertiesFilePath + " can't be resolved to either a URL/a Classpath resource or a File");
                        }
                    }
                }
            }
            if (propertiesFileUrl != null) {
                return propertiesFileUrl.openStream();
            }
        }
        return ClassLoaderUtils.getResourceAsStream(PROPERTIES_FILE_NAME);
    }
593473
static public Properties loadProperties(Properties base, File file) throws IOException {
	FileReader reader = new FileReader(file);
	Properties props = new Properties();
	props.load(reader);
	if (base != null) props.putAll(base);
	reader.close();
	return props;
    }
121350
protected Reader toReader(Object input) throws IOException {
        if (input instanceof Reader) {
            return (Reader) input;
        }

        if (input instanceof InputStream) {
            return new InputStreamReader((InputStream) input);
        }

        if (input instanceof String) {
            return new StringReader((String) input);
        }

        if (input instanceof URL) {
            return new InputStreamReader(((URL) input).openStream());
        }

        if (input instanceof File) {
            return new FileReader((File) input);
        }

        throw new IllegalArgumentException("Unable to turn " + input + " into reader");
    }
975187
public static <T> InputReader getInstance(T input, int size, Set<ParserFeature> features) throws IOException
    {
        return getInstance(input, size, UTF_8, features);
    }