11-01-2009 04:36 PM
So, have you checked whether the input stream obtained via a file:// connection (Connector.open) by any chance implements the Seekable interface on recent v5.0.0 builds?
11-01-2009 05:10 PM
Now that you mention it, I think I was using rev 3 for those tests. I'll get rev 4 and try again tonight, though I'm not hopeful.
We are talking about a vanilla java.io.InputStream here, right?
11-01-2009 05:38 PM - edited 11-01-2009 05:40 PM
I'm not sure what you mean by that. I'm talking about a subclass of InputStream returned by FileConnection.openInputStream() (you can obtain the FIleConnection via Connector.open("file:///...")). I'm wondering (haven't tried this myself) whether this subclass implements Seekable in the latest builds of JDE v5.0.0 or in the latest builds of the v5.0.0 handheld software. Basically, the test is whether "instanceof Seekable" returns true for the object returned by FIleConnection.openInputStream() for files on the /store or /SDCard filesystem.
11-01-2009 08:34 PM
The post I did before was a text search through the HTML documentation in Component Pack 18.104.22.168. I checked again in net.rim.device.api.io by reading the java class files in net_rim_api.jar. None have it implemented. I have not tried Connector.open types but am having trouble because the Storm Simulator for 5.0 is unstable for me but I will try to test it.
I hope it has it because I can't think of a way to go backwords in InputStream/OutputStream without recreating the stream or storing all the data in a array (using up valuable memory).
11-01-2009 09:30 PM
I know about mark and reset but they don't let you truly go backwords in a stream. Unless whatever implements mark and reset can "layer" them so you can mark every byte and then implement a system that can efficently go forwords and backwords with them then it is just a single use only. Besides you need to know the position to mark ahead of time.
11-02-2009 03:11 AM - edited 11-02-2009 03:15 AM
The good news: 5 rev 4 has the instanceof Seekable test work.
I had to coerce the InputStream by casting it and then calling the Seekable methods on it, and a basic test seemed to work! That's incredibly ugly, but it works, so I'm satisfied.
Thanks for all your help, everyone.