In Android I have a text file which can be LARGER or SMALLER then 33 lines. If larger then 33 lines read the LAST 33 lines. If LESS or equal to 33 lines then read ALL lines. The fastest way to do it thanks
OK this is what i got
MAXLINECOUNT=33;
File f = new File("file.......");
if (f.exists())
{
String readString = new String();
int i,l;
i=0;
l=0;
LineNumberReader reader = new LineNumberReader(new FileReader(new File("/mnt/sdcard/data.txt")));
while ((readString = reader.readLine()) != null) {}
l= reader.getLineNumber();
if (l>=MAXLINECOUNT) l=l-(MAXLINECOUNT-3);// i realy need only 30
FileInputStream fileIS = new FileInputStream(f);
BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));
while((readString = buf.readLine())!= null){
if (i>l)
{
process hear ...............
}
i++;