您的位置:首页 > 其它

文件的读写

2014-03-11 22:14 162 查看
public static synchronized Properties getConfigFile(String path)

    {

        private static Properties ConfigProperties = new Properties();

        String configPath = path;

        File file = new File(configPath);

        BufferedInputStream propertyStream = null;

        FileInputStream fis = null;

        try

        {

            if (file.exists())

            {

                fis = new FileInputStream(configPath);

                propertyStream = new BufferedInputStream(fis);

                ConfigProperties.load(propertyStream);

                return ConfigProperties;

            }

            else

            {

                return null;

            }

        }

        catch (Exception e)

        {

            e.printStackTrace();

            return null;

        }

        finally

        {

            closeHandle(fis, propertyStream);

        }

    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: