Java Properties Create toRawString(Properties props)

Here you can find the source of toRawString(Properties props)

Description

to Raw String

License

Apache License

Declaration

public static String toRawString(Properties props) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Properties;

public class Main {
    public static String toRawString(Properties props) {
        ByteArrayOutputStream baos = null;
        try {//ww w.  j  av  a2s  . c o m
            baos = new ByteArrayOutputStream();
            props.store(baos, "");
            return new String(baos.toByteArray());
        } catch (IOException ex) {
            return "";
        } finally {
            if (baos != null) {
                try {
                    baos.close();
                } catch (IOException ex) {
                }
            }
        }
    }
}

Related

  1. toProperties(FileInputStream fis)
  2. toProperties(final Map map)
  3. toProperties(final String value)
  4. toProperties(String jsonStr)
  5. toProperties(String props)
  6. totalPolicies(Class className)