Reading duplicate keys from .properties file

Reading duplicate keys from .properties file

View Answers

October 7, 2011 at 2:05 PM

Try this . It worked for me .

import java.io.BufferedReader;

import java.io.DataInputStream;

import java.io.FileInputStream;

import java.io.InputStreamReader;

public class Sample {

public static void main(String[] args) {

try {

        FileInputStream fstream = new FileInputStream("C:\\java\\prop\\message.properties");
        DataInputStream in = new DataInputStream(fstream);
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String strLine;
        String key[] = null;
        // Read File Line By Line
        while ((strLine = br.readLine()) != null) {
            if (strLine.contains("=")) {
                key = strLine.split("=");
                System.out.println(key[0]);


            } else {
                System.out.println(strLine);
            }
        }
        in.close();
    } catch (Exception e) {
        System.err.println("Error: " + e.getMessage());
    }









Related Tutorials/Questions & Answers:
Reading duplicate keys from .properties file - Development process
Reading duplicate keys from .properties file  Hi, I am reading a .properties file using a basic java program.Though the .properties file will not allow duplicate keys, but still I want to develope a program to identify
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
Advertisements
Reading a file from Jar JAVA
Reading a file from Jar JAVA  I have added one excel sheet into a jar file. can anybody tell me how i can read that file. actually when i am running code from eclipse i able to read it but when i am adding that jar file
Reading a file from Jar JAVA
Reading a file from Jar JAVA  I have added one excel sheet into a jar file. can anybody tell me how i can read that file. actually when i am running code from eclipse i able to read it but when i am adding that jar file
Reading string from file timed
Reading string from file timed  So I want to make a file reader/ buffered reader that reads a new line of the textfile, lets say every 30 second. Like it reads the first line, waiting 30 seconds, read the next line and so one
Detecting Duplicate Keys
Detecting Duplicate Keys  Detecting Duplicate Keys I have a program... constraint. If the user attempts to insert a duplicate name into the table, I want to display an error message by processing the error code from the database. How
Reading text from image file - Java Beginners
Reading text from image file  How Read text from image file
reading a csv file from a particular row
reading a csv file from a particular row  how to read a csv file from a particular row and storing data to sql server by using jsp servlet
initialise array by reading from file - Java Beginners
initialise array by reading from file  Hello, I wnat to know how i would initialise an array by reading a text file, which contains a simple pattern. for example the file may look as shown below, with the star character
Reading XML from a File
Reading XML from a File       This Example shows you how to Load Properties from the XML file via... File from where properties are to be loaded.ADS_TO_REPLACE_1
Writing to and reading from a binary file in java.
Writing to and reading from a binary file in java.  I have written... the binary file from another program as follows: m_dis = new DataInputStream... work, but the records obtained after reading the binary file are much less than
jar file not reading input from serial port
jar file not reading input from serial port  i used a coding for getting data from serial port. JOptionbox with "port not found" message is shown when i execute thru jar file. but when i execute thru netbeans, data is received
jar file not reading input from serial port
jar file not reading input from serial port  i used a coding for getting data from serial port. JOptionbox with "port not found" message is shown when i execute thru jar file. but when i execute thru netbeans, data is received
reading data from excel file and plotting graph
reading data from excel file and plotting graph  I am doing a project using NetBeans in which i have to take input an excel file and then using... at the same time from one excel file using different columns..how can i do that? waiting
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
How to write .properties file from jsp
How to write .properties file from jsp  Hi i new to java i stuck here please help me... my problem is "I wrote a class to write the .properties file... to implement/write .properties file from jsp. Regards, Venkatesh Gurram.ADS
Write Keys and Values to the Properties file in Java
Write Keys and Values to the Properties file in Java... how to write keys and values in the properties files through the Java program. The program for writing keys and values to the properties file has been mentioned
need to update key , value pair in map from properties file
want the keys and values to be dynamically updated into map. that is i have .properties file where i will update the keys and values whenever needed. i want...need to update key , value pair in map from properties file  I have
Loading properties from a XML file
Loading properties from a XML file       This Example shows you how to Load properties from a XML... parsers. Some of the methods used for loading properties from a XML file
Removing duplicate white spaces from a text file
Removing duplicate white spaces from a text file  ... duplicate white spaces from a specific text file. In this section a program is given... spaces from the given text file. This program reads the file line-by-line for search
How to read and display data from a .properties file from a jsp page
How to read and display data from a .properties file from a jsp page  I have a .properties file. I have to create a jsp page such that it reads the data from this .properties file and display it in table format. Ex:by using
reading the records from a .xlsx file and storing those records in database table
reading the records from a .xlsx file and storing those records in database table  Here is my requirement, I want to read the records from a .xlsx file and store that records in database table. I tried like this public class
reading multiple files from a directory and writing them into a single file
reading multiple files from a directory and writing them into a single file... file i get an empty text file can you guide me how to do this: /*this program reads multiple files * from a single directory. */ package elite.tech.com
PHP duplicate file - PHP
PHP duplicate file   i wanted to duplicate a PHP file resides in different directory on submission
Properties file in Java
to read key and it's regarding values from the properties file.   ... Properties file in Java       Properties file in Java In this section, you will know
Display non-duplicate words from file
Display non-duplicate words from file In this tutorial, you will learn how to read a text file and display non-duplicate words in ascending order. The given code reads the file and stored the file text into StringBuffer. The buffer
Java error reading from file
Java error reading from file       Java error reading file... reading from file. For this we have a class error reading from file. Inside
Reading the data from property file from java stand alone application in linux
Reading the data from property file from java stand alone application in linux  Please send me the example of reading the data from a property file from java stand alone application in linux. I don't know how to give path
Java Read username, password and port from properties file
Java Read username, password and port from properties file In this section... the properties file and display the data from the database. Now to load the data from... to a stream or loaded from a stream using the properties file
Problem to print from my properties file - Java Server Faces Questions
Problem to print from my properties file  Hi, I am a new user of this site. It is very interesting. So this is my problem: I have a jsp file where i try to print some messages from my properties file but when i execute
Problem to print from my properties file - Java Server Faces Questions
Problem to print from my properties file  Hi, I am a new user of this site. It is very interesting. So this is my problem: I have a jsp file where i try to print some messages from my properties file but when i execute
Get All Keys and Values of the Properties files in Java
the features to collection of all keys and values of the properties file... and value from properties file in Java?"ADS_TO_REPLACE_3   Here...Get All Keys and Values of the Properties files in Java
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.
Writing a Program to calculate Circumference of planets reading from a file... a program to read data from a file. Then use the numerical data within... stumped when it comes to reading the file and writing to a new file. My code
svg file reading and display
svg file reading and display  i want a sample program for reading and displaying the content of a svg file
Properties file in Java
. The properties file is a simple text file. Properties file contains keys and values for the specific key. Keys of properties file is always on left side and it's value..._TO_REPLACE_1 Here, keys and values are specified in the properties file as follows: #Mon
Reading a text file in java
Reading a text file in java  What is the code for Reading a text file... in java.io.* package for reading and writing to a file in Java. To learn more about reading text file in Java see the tutorial Read File in Java. Thanks
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.
Writing a Program to calculate Circumference of planets reading from a file... a program to read data from a file. Then use the numerical data within... it comes to reading the file and writing to a new file. My code is as follows
Write the Keys and Values of the Properties files in Java
will see in the properties file, your inserted keys and values had been inserted..., String val): This method used to insert the keys and values in the properties file... Write the Keys and Values of the Properties files in Java
Thread for reading txt file
Thread for reading txt file  how to use 3 thread to read 3 txt file? To create three threads for reading the file and three threads for getting the strings out of the queue and printing them. thanks
Problem reading word file
Problem reading word file  Deepak you provide me code for extarcting equation from a word file and also to write in a word file.But when I again want to read preveously created word file(created by your code) it gives an error
Reading big file in Java
Reading big file in Java  How to read a big text file in Java program?   Hi, Read the complete tutorial at How to read big file line by line in java? Thanks
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
reading from pdf
reading from pdf  how can i read specific words from pdf file?   Java Read pdf file import java.io.*; import java.util.*; import com.lowagie.text.*; import com.lowagie.text.pdf.*; public class ReadPDF { public
Reading an excel file into array
Reading an excel file into array  Hi, I'm trying to read in an excel file, search a column for containing key words (entered by a user) and then displaying the matching rows in a table. I'm fairly new to JavaScript. Can anyone
External file reading in jsp
External file reading in jsp  i have written a jsp page(ReadExt.jsp) in my application which reads a text file content from a system... file. It uses BufferedReader class to read that particular file. <%@ page
External file reading in jsp
External file reading in jsp  i have written a jsp page(ReadExt.jsp) in my application which reads a text file content from a system...; The given code reads the given file. It uses BufferedReader class to read
Reading a big file effeciently
Reading a big file effeciently  How to read a large text file quickly without memory error in Java? What is the best method to read a big file very efficiently? Thanks   Hi, Kindly check the program Java Read File
Reading file into bytearrayoutputstream
input stream and byte output stream. This is and good example of reading file... In this example we have used the class InputStream for reading the file... import java.io.*; /** * Example of Reading file into byte array
Java read properties file
files. Now to load the data from the properties file, we have used Properties... Video tutorial of reading properties file in Java: "How to read...Java read properties file In this section, you will learn how to read

Ads