...
> I use KXML ..
Do you mean this one? <http://kxml.sourceforge.net/>
I saw one link that suggested it was geared to
J2ME - though I cannot see 'J2Me' on the
sourceforge page. Is it oriented to J2ME?
(If it is that one, note they have a mailing list amongst
the links on the left - might be a good place for more
specialised help.)
Andrew T.
sgoo - 26 Nov 2006 15:23 GMT
Haven't played with this KXML. Does it have a constructor that takes an
InputStream type as an argument? If so, you can create your own version
of CountingBytesInputStream which acts as a filter. Something like
this:
class CountingBytesInputStream extends FilterInputStream {
... // implements methods that call super's methods
int getCount() {
...
}
}
Then you can call:
CountingBytesInputStream cbis = new
CountingBytesInputStream(inStream);
KXML k = new KXML(cbls);
....
System.err.println(clbs.getCount());
You can even add a callback into this class. For example, the
constructor can be
CountingBytesInputStream(Updater u, InputStream stream) {
this.updater = u;
}
And then you can call it in the overriden read methods like this
int read(...) {
.....
if (count % 1024 == 0) updater.notify(count);
}