/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sortarraytrial;
/**
*
* @author Yokaaa
*/
import java.util.Arrays;
import java.util.Vector;
import java.io.*;
public class SortArrayTrial {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//// TODO code application logic here
// The name of the file to open.
String fileName = "F:\\3rd year fcis\\movies1.txt";
Vector<String> vectString = new Vector<String>();
// This will reference one line at a time
String line = null;
try {
// FileReader reads text files in the default encoding.
FileReader fileReader =
new FileReader(fileName);
// Always wrap FileReader in BufferedReader.
BufferedReader bufferedReader =
new BufferedReader(fileReader);
int i=0;
int index=0;
Vector<String> tmp = new Vector<String>();
String [] tmp1= new String[4];
Vector<Vector<String>> bigvec = new Vector<Vector<String>>();
while((line = bufferedReader.readLine()) != null) {
// System.out.println(line);
tmp1=line.split("/");
vectString.clear();
for (int m=0; m<tmp1.length; m++)
vectString.add(tmp1[m]);
bigvec.add(index,vectString);
}
for (int m=0; m<tmp1.length; m++)
{ System.out.println("record of "+m);
System.out.println(bigvec.get(m));
}
// Always close files.
bufferedReader.close();
}
catch(FileNotFoundException ex) {
System.out.println(
"Unable to open file '" +
fileName + "'");
}
catch(IOException ex) {
System.out.println(
"Error reading file '"
+ fileName + "'");
// Or we could just do this:
// ex.printStackTrace();
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.