I
iksrazal
Hi all,
I have to create an element tree as follows:
Data A
|
|
Data B
|
|
Data C
There can be multiple Data A, each of which can have many Data B, and
each Data B can have many Data C. There is no order in the file in
which Data A, Data B, Data C can appear - only a marker 'Data A', for
example at the beginning of a line. The file size is two megs - but %90
percent is ignored. There are multiple files, but the data is seperate
and should have no dependency clashes.
My first thought is to do it as such:
RandomAccessFile raf = new RandomAccessFile("BSS0","r");
InputStream in = new FileInputStream(raf.getFD());
BufferedReader reader = new BufferedReader ( new InputStreamReader ( in
) );
while ((line = reader.readLine()) != null) {
// find data A
Scanner sc = new Scanner(line);
}
// now, rewind raf
raf.seek(0);
repeat finding Data B which matches data A, and Data C which matches
Data B.
In essence re-reading the same file several times.
The other thing is the collection. How would one map a Data A
one-to-many relationship to Data B, which has a one-to-many
relationship with Data C?
I'm just getting started, but I'd appreciate any ideas.
iksrazal
I have to create an element tree as follows:
Data A
|
|
Data B
|
|
Data C
There can be multiple Data A, each of which can have many Data B, and
each Data B can have many Data C. There is no order in the file in
which Data A, Data B, Data C can appear - only a marker 'Data A', for
example at the beginning of a line. The file size is two megs - but %90
percent is ignored. There are multiple files, but the data is seperate
and should have no dependency clashes.
My first thought is to do it as such:
RandomAccessFile raf = new RandomAccessFile("BSS0","r");
InputStream in = new FileInputStream(raf.getFD());
BufferedReader reader = new BufferedReader ( new InputStreamReader ( in
) );
while ((line = reader.readLine()) != null) {
// find data A
Scanner sc = new Scanner(line);
}
// now, rewind raf
raf.seek(0);
repeat finding Data B which matches data A, and Data C which matches
Data B.
In essence re-reading the same file several times.
The other thing is the collection. How would one map a Data A
one-to-many relationship to Data B, which has a one-to-many
relationship with Data C?
I'm just getting started, but I'd appreciate any ideas.
iksrazal