How to read java arraylist in pl/sql ? [message #591443] |
Sun, 28 July 2013 23:25  |
 |
s1984
Messages: 5 Registered: May 2012 Location: chennai
|
Junior Member |
|
|
Hi All,
I have created below program to read data from text file and stores in ArrayList. I want to read that arrylist in Oracle forms 11g.
Glad if you could help me on this.
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class getLegends {
public static void main(String[] args) {
getLegends fileReaderService = new getLegends ();
fileReaderService.performExecute("RD_RM_TIME_TBL");
}
public List<String[]> performExecute(String inputPattern) {
List<String[]> matches = new ArrayList<String[]>();
try {
FileInputStream fileInputStream = new FileInputStream("./getLabel/data.txt"); /*change your file path here*/
DataInputStream dataInputStream = new DataInputStream(fileInputStream);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInputStream));
String strLine;
while ((strLine = bufferedReader.readLine()) != null) {
if (strLine.contains(inputPattern)) {
String[] splits = strLine.split("\\s*,\\s*");
matches.add(splits);
}
}
dataInputStream.close();
for (String[] items : matches) {
System.out.println(items[0] + "\t" +items[1] + "\t" + items[2] + "\t" + items[3] + "\t" + items[4]);
}
} catch (Exception e) {
e.printStackTrace();
}
return matches;
}
}
I have created a jar file and imported into forms.
[Updated on: Sun, 28 July 2013 23:26] Report message to a moderator
|
|
|
|
|