Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > AudioFileReader / SPI / unrecognized formats

Reply
Thread Tools

AudioFileReader / SPI / unrecognized formats

 
 
Andrew Thompson
Guest
Posts: n/a
 
      01-02-2009
What should an AudioFileReader.getAudioInputStream(InputStream)*
do/throw when it encounters an unrecognized stream?

The JavaDocs declare that it throws an UnsupportedAudioFileException.

* <http://java.sun.com/javase/6/docs/ap...d/sampled/spi/
AudioFileReader.html#getAudioInputStream(java.io.I nputStream)>

I am developing a new sound format. After some months of wrangling
with the build tools to get an app. that correctly registers a new
audio
type via the ServiceProvider interface (fixed in the end, by upgrading
to
the latest version of Ant), I am now puzzling over what to do when
the
new class is handed an audio stream that is handled by one of the
*pre-existing* formats.

If I throw an UnsupportedAudioFileException when handed a format
that is not the new one, the app. can no longer read existing formats.
If I fail to throw an UAFE, my class is left trying to deal with data
for which it was not designed, and cannot cope.

Anybody encountered this before / have any tips on how to proceed?

--
Andrew Thompson
http://pscode.org/
 
Reply With Quote
 
 
 
 
Michael Rauscher
Guest
Posts: n/a
 
      01-03-2009
Hi Andrew,

Andrew Thompson wrote:
> What should an AudioFileReader.getAudioInputStream(InputStream)*
> do/throw when it encounters an unrecognized stream?

....
> the latest version of Ant), I am now puzzling over what to do when
> the
> new class is handed an audio stream that is handled by one of the
> *pre-existing* formats.
>
> If I throw an UnsupportedAudioFileException when handed a format
> that is not the new one, the app. can no longer read existing formats.


I haven't tried it, but I'd expect AudioSystem to try-catch-iterate over
the registered providers (at least, if a File, URL or InputStream is given).

Bye
Michael
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      01-03-2009
On Jan 3, 11:40*am, Michael Rauscher <michlm...@gmx.de> wrote:
> > ...
> > If I throw an UnsupportedAudioFileException when handed a format
> > that is not the new one, the app. can no longer read existing formats.

>
> I haven't tried it, but I'd expect AudioSystem to try-catch-iterate over
> the registered providers (at least, if a File, URL or InputStream is given).


I'd have thought so as well, but throwing
an UAFE within my own reader stops the
process, whatever that process is.

...Now I look at the source for
AudioSystem.getAudioInputStream(InputStream)
it supports what you are saying, it iterates
a list of the AudioFileReaders, try/catching
on UAFE!

I'll think some more on where /I/ am going
wrong with that process..

--
Andrew Thompson
http://pscode.org/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is MKV formats better than other video formats? helena68 Software 3 11-26-2008 07:57 AM
Detailed Analysis of the file formats for M$ Office 2007 -"Microsoft Office XML Formats? Defective by design" Jonathan Walker NZ Computing 1 08-26-2007 03:43 AM
SPI Problem Fizzy VHDL 4 04-12-2006 09:19 PM
CyberLink Supports UDF 2.5/2.6 Formats For Blu-ray and HD DVD next generation of disc formats. Allan DVD Video 0 07-15-2005 07:43 PM
SPI serial output counter or latch? bob VHDL 1 02-15-2005 09:32 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57