Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified
Accepted Solution

net.rim.device.api.io.Seekable in 5.0 -- the point?

Having random file access in 5.0 is good. Except all I've seen is an interface that nothing seems to implement (yet?)

 

Have I missed something? Or are there going to be some classes in 5.0 that will eventually implement this interface?

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

It might just be that the documentation has not been updated. I can't find anything that implements it but it doesn't mean it's not implemented somewhere.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

The OS does not have to provide implementations of these interfaces. It could be the other way round: the OS or the built-in media player could be the clients of these interfaces.

 

When you implement your own SourceStream, you can make it provide controls that implement this interface (or any other media control interfaces for that matter). It would be interesting to see whether the built-in media player starts invoking methods on this interface if you provide the player with a media control implementing the interface.

Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

If the OS or media player (and media applications aren't the only intended use with random file access!) are clients of the interface, some API class must implement them somewhere, if those applications make use of the public API -- if they do not, then we're back where we've started -- no classes as far as I've seen implement the interface so there's no actual implementation of random file access as far as I've seen or understood.

 

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

In theory, not a single class in the BlackBerry OS has to implement the interface. In partice, some of them probably do.

 

The OS's media player playback module does not have to implement the Seekable interface -- it is rather a client of the interface. Some of the built-in implementations of media sources, for example, those that play local files, might provide controls that implement this interface. However, these classes aren't usually covered by the javadocs offered to third-party developers.

 

Therefore, I don't find it strange that there are no classes in third-party developer javadocs that implement the Seekable interface. I think the reason for this interface being listed in the javadocs is twofold. Firstly, (you being a provider) you can implement your own controls that offer the Seekable capability and the media player might take advantage of these controls since it knows about the Seekable interface. Secondly, (you being the consumer/client) if you instantiate some built-in media sources, they might provide you with a control that implements the Seekable interface, thus enabling your application to perform more actions on the source/stream.

Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

Yes, I'm well aware of this.

 

I think what it boils down to is this: in the release notes and documentation about new API features in 5.0, "Random File Access: Read data from and write data to any specified location within a file" is what is described. I expect that to mean that I should be able to, somehow, be able to do this. You are describing a perfectly valid use-case scenario for this interface, but having one interface with no additional provided classes implementing it does not match what is advertised "on the tin".

 

(NB: I could subclass an InputStream and very well implement Seekable, but anything that I produce is not going to be nearly as efficient or correct as something that is API-provided).

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

[ Edited ]

P.S. It occurred to me after some thinking, that you might be puzzled about Seekable and other such media control interfaces because you think there should be a ready-made control that you can instantiate and pass into an arbitrary media player attached to an arbitrary media source. I don't believe that's the case, because the design of the media player API seems to assume that the media player obtains controls from the particular media source it's playing and these controls "know" how to control this particular source.

 

EDIT: sorry, I posted this almost at the same time with you posting your last comment, so I didn't take your comment into account.

Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

[ Edited ]

I don't intend to use random file access for media playing purposes.

 

What I intend to do is to try and implement a mechanism for reading large files without having to slurp them up entirely into memory or have linear access to (which an InputStream only provides).

 

Hey, if someone knows a way of doing this without random file access, let me know, but I sure can't think of anything so far.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

[ Edited ]

Please disregard all my comments in this thread. I was under a very wrong impression that this thread was about media control interfaces. I completely missed the fact that Seekable is in a completely different package and has nothing to do (directly) with media playback.

 

I can't seem to find a way to delete my blatantly wrong comments... Let's hope people don't get too confused when reading these comments...

Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: net.rim.device.api.io.Seekable in 5.0 -- the point?

They're not explicitly wrong, like I said, they just describe a different use-case than the one intended Smiley Happy