wood burning stoves 2.0*
The moose likes Java in General and the fly likes InputStream and its size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "InputStream and its size" Watch "InputStream and its size" New topic
Author

InputStream and its size

olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
Hello,

following problem: i want to build a audio player which retrieves an InputStream from the HttpClient (Apache HttpClient) and play it (i use JLayer for the playback).
I can play the audio streams without any problem, but i cannot "scroll in the stream", because i dont know how much has been already downloaded into ram.

I found the skip method but i'm not sure if thats what im looking for, because it looks like it just reads and jumps over the byte, which means i download it twice.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

The available() method tells you how many bytes are available right now. That's not the same as the number of bytes in total, but it's the closest you're going to get.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
Thanks alot!
Because you know everything, one further question
I'd like to show the amount of already downloaded bytes in the JSlider.
In some players theres a grey bar which shows the user how far he can play forward, is there something already implemented in the jslider?
I didnt find anything... or how could this be realized?

Thanks in advance
olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
i open a new thread in the swing section
 
GeeCON Prague 2014
 
subject: InputStream and its size