Below is my code to read and split the text file content.
try {
br = new BufferedReader(new FileReader(\"F:\\\\Test.txt\"));
final char[] cbuf
Your doing it the hard way by not using readLine
try {
FileInputStream fis = new FileInputStream("F:\\Test.txt");
reader = new BufferedReader(new InputStreamReader(fis));
String line = reader.readLine();
while(line != null){
//process your line here, it's just a String...
line = reader.readLine();
}
} catch (FileNotFoundException ex) {
...
} catch (IOException ex) {
try (Scanner read = new Scanner(new File("/tmp/datafile.txt"));) {
read.useDelimiter("@");
while (read.hasNext()) {
String splitedPacket = read.next();
System.out.println(splitedPacket);
// Perform DB Operation
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}