3:13 pm - Friday December 17, 4545

To Load a property list from the input byte stream using Properties.load(InputStream inStream)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

 

                                                           This tutorial explains how to Load a property list from the input byte stream using Properties.load(InputStream inStream) method.Properties load(InputStream inStream) reads a property list (key and element pairs) from the input byte stream.


import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.util.Properties;

public class PropertyInputStream

{

	public static void main(String[] args) throws Exception

	{

		Properties prop = new Properties();

		String s = "Chapter Count=200";

		String s2 = "Tutorial Count=15";

		FileOutputStream fos = new FileOutputStream("properties.txt");

		FileInputStream fis = new FileInputStream("properties.txt");

		fos.write(s.getBytes());

		fos.write("\n".getBytes());

		fos.write(s2.getBytes());

		prop.load(fis);

		prop.list(System.out);

	}

}

Output

– listing properties –

Chapter=Count=200

Tutorial=Count=15

BACK

Filed in: Java Examples

Comments are closed.