// Path: src/main/java/com/tngtech/propertyloader/impl/interfaces/PropertyLoaderOpener.java
// public interface PropertyLoaderOpener {
// 
//     /**
//      * Attempt to find and open some property file.
//      *
//      * @param fileName A relative filename (using '/' as directory separator on all platforms)
//      * @return An input stream reading from that file, or null if the file could not be found
//      */
//     InputStream open(String fileName);
// }


import com.tngtech.propertyloader.impl.interfaces.PropertyLoaderOpener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.InvalidPropertiesFormatException;
import java.util.Properties;
        Properties newProperties;

        InputStream stream = opener.open(fileName);

        if (stream == null) {
            log.debug("file {} not found {}", fileName, opener.toString());
            newProperties = propertyLoaderFactory.getEmptyProperties();
        } else {
            log.info("file {} found for reading {} with encoding {}", fileName, opener.toString(), propertyFileEncoding);
            if (fileName.toLowerCase().endsWith("xml")) {
                log.debug("attempting to find and read xml file {} {}", fileName, opener.toString());
                try {
                    newProperties = readFromXML(stream);
                } catch (InvalidPropertiesFormatException e) {
                    throw new PropertyFileReaderException(String.format("error reading properties from from '%s': this xml file is not a valid properties format", fileName), e);
                } catch (IOException e) {
                    throw new PropertyFileReaderException(String.format("error reading properties from stream created from '%s' in opener '%s'", fileName, opener.toString()), e);
                }
            } else {
                log.debug("attempting to find and read properties file {} with encoding {} {}", fileName, propertyFileEncoding, opener.toString());
                try {
                    newProperties = read(stream, propertyFileEncoding);
                } catch (IOException e) {
                    throw new PropertyFileReaderException(String.format("error reading properties from stream created from '%s' with encoding '%s' in opener '%s'", fileName, propertyFileEncoding, opener.toString()), e);
                }
            }
        }
        return newProperties;
    }

// Path: src/main/java/com/tngtech/propertyloader/impl/interfaces/PropertyLoaderOpener.java
// public interface PropertyLoaderOpener {
// 
//     /**
//      * Attempt to find and open some property file.
//      *
//      * @param fileName A relative filename (using '/' as directory separator on all platforms)
//      * @return An input stream reading from that file, or null if the file could not be found
//      */
//     InputStream open(String fileName);
// }


// Path: src/main/java/com/tngtech/propertyloader/impl/PropertyFileReader.java
import com.tngtech.propertyloader.impl.interfaces.PropertyLoaderOpener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.InvalidPropertiesFormatException;
import java.util.Properties;

        Properties newProperties;

        InputStream stream = opener.open(fileName);

        if (stream == null) {
            log.debug("file {} not found {}", fileName, opener.toString());
            newProperties = propertyLoaderFactory.getEmptyProperties();
        } else {
            log.info("file {} found for reading {} with encoding {}", fileName, opener.toString(), propertyFileEncoding);
            if (fileName.toLowerCase().endsWith("xml")) {
                log.debug("attempting to find and read xml file {} {}", fileName, opener.toString());
                try {
                    newProperties = readFromXML(stream);
                } catch (InvalidPropertiesFormatException e) {
                    throw new PropertyFileReaderException(String.format("error reading properties from from '%s': this xml file is not a valid properties format", fileName), e);
                } catch (IOException e) {
                    throw new PropertyFileReaderException(String.format("error reading properties from stream created from '%s' in opener '%s'", fileName, opener.toString()), e);
                }
            } else {
                log.debug("attempting to find and read properties file {} with encoding {} {}", fileName, propertyFileEncoding, opener.toString());
                try {
                    newProperties = read(stream, propertyFileEncoding);
                } catch (IOException e) {
                    throw new PropertyFileReaderException(String.format("error reading properties from stream created from '%s' with encoding '%s' in opener '%s'", fileName, propertyFileEncoding, opener.toString()), e);
                }
            }
        }
        return newProperties;
    }

    private Properties read(InputStream stream, String propertyFileEncoding) throws IOException {