wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes JLayer wont abort the InputStream (from a HTTP Server) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "JLayer wont abort the InputStream (from a HTTP Server)" Watch "JLayer wont abort the InputStream (from a HTTP Server)" New topic
Author

JLayer wont abort the InputStream (from a HTTP Server)

olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
Hi,

i have a http server which gives me some media files (mp3 etc.)
i use JLayer to play the media files which works fine
the big problem is that some files are really big and the Player class just wont stop downloading them when i hit the "stop" button
i have no idea what could going on...

JLayer uses a class called "Bitstream" which has a source field - this is a PushbackInputStream.
When it now goes to the source.close() line it just wont stop download the file (into the ram).

Can please someone help me how i can fix this?
olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
when i say:
player.close(); it simply does nothing (but it calls close() on the PushbackInputStream).
When i call myUglyPlayThread.stop() it stops downloading but the thread locks :/
olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
it was a problem with apache httpclient..., no not a problem, a feature
i had to cast the stream (i get the stream via httpget())
i thought its a normal InputStream, but its an EofSomethingStream which had an abort() method which does it now for me
furthermore i use AdvancedPlayer because i can implement what happens when the close method of the player has been called
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JLayer wont abort the InputStream (from a HTTP Server)