M
McGregor
Hello!
I'm trying to read a file line by line with following code-snippet:
-----------------------------**-------------------------------
BufferedReader test = new BufferedReader(new FileReader(datei));
String tmp = "";
Vector data = new Vector();
boolean first = true;
int breaker = 0;
int position = 0;
while ((tmp = test.readLine()) != null) {
if (!first) data.addElement(tmp); else first = false;
if (tmp.contains("%%EOF")) breaker = position;
position++;
}
while (data.size() > breaker) data.remove(data.size()-1);
-----------------------------**-------------------------------
there are many "%%EOF" - lines within this file. I need to get the
last one and this is my solution to get the whole data from the second
line to the last line with "%%EOF"
But I encountered some problems. Some lines are very long, i.e. more
than 8000 characters (varied, depends on the file). When reading the
file using the above code I only get aprox. 1520 characters and the
remaing characters are lost and reading stops with no error at all.
So I need some other solution to read my file. Keep in mind, that I
need to compare strings...
Does anyone know any (nice) solution?
Thanks for your help.
McGregor
I'm trying to read a file line by line with following code-snippet:
-----------------------------**-------------------------------
BufferedReader test = new BufferedReader(new FileReader(datei));
String tmp = "";
Vector data = new Vector();
boolean first = true;
int breaker = 0;
int position = 0;
while ((tmp = test.readLine()) != null) {
if (!first) data.addElement(tmp); else first = false;
if (tmp.contains("%%EOF")) breaker = position;
position++;
}
while (data.size() > breaker) data.remove(data.size()-1);
-----------------------------**-------------------------------
there are many "%%EOF" - lines within this file. I need to get the
last one and this is my solution to get the whole data from the second
line to the last line with "%%EOF"
But I encountered some problems. Some lines are very long, i.e. more
than 8000 characters (varied, depends on the file). When reading the
file using the above code I only get aprox. 1520 characters and the
remaing characters are lost and reading stops with no error at all.
So I need some other solution to read my file. Keep in mind, that I
need to compare strings...
Does anyone know any (nice) solution?
Thanks for your help.
McGregor