This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JLayer wont abort the InputStream (from a HTTP Server)

 
olze oli
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!