Here you can find the source of serialize(Properties props)
Parameter | Description |
---|---|
props | the properties |
Parameter | Description |
---|---|
IOException | if an error occurs |
public static String serialize(Properties props) throws IOException
//package com.java2s; /*// w ww .ja v a 2 s. c o m * Copyright (C) 2002-2014 FlyMine * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. See the LICENSE file for more * information or http://www.gnu.org/copyleft/lesser.html. * */ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Properties; public class Main { /** * Serialize properties to a string suitable for a subsequent load() * @param props the properties * @return the string * @throws IOException if an error occurs */ public static String serialize(Properties props) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); props.store(baos, null); return baos.toString(); } }