Here you can find the source of savePropertiesToString(Properties props, String comment)
Parameter | Description |
---|---|
props | a parameter |
comment | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static String savePropertiesToString(Properties props, String comment) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2006 Sybase, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w w w . j a v a 2s . c o m * Sybase, Inc. - initial API and implementation *******************************************************************************/ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Properties; public class Main { /** * @param props * @param comment * @return the string * @throws IOException */ public static String savePropertiesToString(Properties props, String comment) throws IOException { if (props == null) return null; ByteArrayOutputStream out = new ByteArrayOutputStream(); props.store(out, comment); String tmpString = out.toString(); out = null; return tmpString; } }