Package org.apache.commons.configuration.sync

Examples of org.apache.commons.configuration.sync.SynchronizerSupport


     */
    private void loadFromStream(InputStream in, String encoding, URL url)
            throws ConfigurationException
    {
        checkContent();
        SynchronizerSupport syncSupport = fetchSynchronizerSupport();
        syncSupport.lock(LockMode.WRITE);
        try
        {
            injectFileLocator(url);

            if (getContent() instanceof InputStreamSupport)
            {
                loadFromStreamDirectly(in);
            }
            else
            {
                loadFromTransformedStream(in, encoding);
            }
        }
        finally
        {
            syncSupport.unlock(LockMode.WRITE);
        }
    }
View Full Code Here


     */
    private void saveToStream(OutputStream out, String encoding, URL url)
            throws ConfigurationException
    {
        checkContent();
        SynchronizerSupport syncSupport = fetchSynchronizerSupport();
        syncSupport.lock(LockMode.WRITE);
        try
        {
            injectFileLocator(url);
            Writer writer = null;

            if (encoding != null)
            {
                try
                {
                    writer = new OutputStreamWriter(out, encoding);
                }
                catch (UnsupportedEncodingException e)
                {
                    throw new ConfigurationException(
                            "The requested encoding is not supported, try the default encoding.",
                            e);
                }
            }

            if (writer == null)
            {
                writer = new OutputStreamWriter(out);
            }

            saveToWriter(writer);
        }
        finally
        {
            syncSupport.unlock(LockMode.WRITE);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.sync.SynchronizerSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.