javazoom.spi.mpeg.sampled.file
Class MpegAudioFileReader

java.lang.Object
  extended by javax.sound.sampled.spi.AudioFileReader
      extended by org.tritonus.share.sampled.file.TAudioFileReader
          extended by javazoom.spi.mpeg.sampled.file.MpegAudioFileReader

public class MpegAudioFileReader
extends org.tritonus.share.sampled.file.TAudioFileReader

This class implements AudioFileReader for MP3 SPI.


Field Summary
static int INITAL_READ_LENGTH
           
static java.lang.String VERSION
           
 
Constructor Summary
MpegAudioFileReader()
           
 
Method Summary
 javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.io.File file)
          Returns AudioFileFormat from File.
 javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.io.InputStream inputStream, long mediaLength)
          Returns AudioFileFormat from inputstream and medialength.
 javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.net.URL url)
          Returns AudioFileFormat from URL.
 javax.sound.sampled.AudioInputStream getAudioInputStream(java.io.File file)
          Returns AudioInputStream from file.
 javax.sound.sampled.AudioInputStream getAudioInputStream(java.io.InputStream inputStream)
          Return the AudioInputStream from the given InputStream.
 javax.sound.sampled.AudioInputStream getAudioInputStream(java.net.URL url)
          Returns AudioInputStream from url.
protected  void loadShoutcastInfo(java.io.InputStream input, java.util.HashMap props)
          Load shoutcast (ICY) info.
protected  void parseID3v1Frames(byte[] frames, java.util.HashMap props)
          Parser ID3v1 frames
protected  void parseID3v2Frames(java.io.InputStream frames, java.util.HashMap props)
          Parse ID3v2 frames to add album (TALB), title (TIT2), date (TYER), author (TPE1), copyright (TCOP), comment (COMM) ...
protected  java.lang.String parseText(byte[] bframes, int offset, int size, int skip)
          Parse Text Frames.
 
Methods inherited from class org.tritonus.share.sampled.file.TAudioFileReader
calculateFrameSize, getAudioFileFormat, getAudioInputStream, readIeeeExtended, readLittleEndianInt, readLittleEndianShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

INITAL_READ_LENGTH

public static final int INITAL_READ_LENGTH
See Also:
Constant Field Values
Constructor Detail

MpegAudioFileReader

public MpegAudioFileReader()
Method Detail

getAudioFileFormat

public javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.io.File file)
                                                       throws javax.sound.sampled.UnsupportedAudioFileException,
                                                              java.io.IOException
Returns AudioFileFormat from File.

Overrides:
getAudioFileFormat in class org.tritonus.share.sampled.file.TAudioFileReader
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

getAudioFileFormat

public javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.net.URL url)
                                                       throws javax.sound.sampled.UnsupportedAudioFileException,
                                                              java.io.IOException
Returns AudioFileFormat from URL.

Overrides:
getAudioFileFormat in class org.tritonus.share.sampled.file.TAudioFileReader
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

getAudioFileFormat

public javax.sound.sampled.AudioFileFormat getAudioFileFormat(java.io.InputStream inputStream,
                                                              long mediaLength)
                                                       throws javax.sound.sampled.UnsupportedAudioFileException,
                                                              java.io.IOException
Returns AudioFileFormat from inputstream and medialength.

Specified by:
getAudioFileFormat in class org.tritonus.share.sampled.file.TAudioFileReader
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

getAudioInputStream

public javax.sound.sampled.AudioInputStream getAudioInputStream(java.io.File file)
                                                         throws javax.sound.sampled.UnsupportedAudioFileException,
                                                                java.io.IOException
Returns AudioInputStream from file.

Overrides:
getAudioInputStream in class org.tritonus.share.sampled.file.TAudioFileReader
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

getAudioInputStream

public javax.sound.sampled.AudioInputStream getAudioInputStream(java.net.URL url)
                                                         throws javax.sound.sampled.UnsupportedAudioFileException,
                                                                java.io.IOException
Returns AudioInputStream from url.

Overrides:
getAudioInputStream in class org.tritonus.share.sampled.file.TAudioFileReader
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

getAudioInputStream

public javax.sound.sampled.AudioInputStream getAudioInputStream(java.io.InputStream inputStream)
                                                         throws javax.sound.sampled.UnsupportedAudioFileException,
                                                                java.io.IOException
Return the AudioInputStream from the given InputStream.

Overrides:
getAudioInputStream in class org.tritonus.share.sampled.file.TAudioFileReader
Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

parseID3v1Frames

protected void parseID3v1Frames(byte[] frames,
                                java.util.HashMap props)
Parser ID3v1 frames

Parameters:
frames -
props -

parseID3v2Frames

protected void parseID3v2Frames(java.io.InputStream frames,
                                java.util.HashMap props)
Parse ID3v2 frames to add album (TALB), title (TIT2), date (TYER), author (TPE1), copyright (TCOP), comment (COMM) ...

Parameters:
frames -
props -

parseText

protected java.lang.String parseText(byte[] bframes,
                                     int offset,
                                     int size,
                                     int skip)
Parse Text Frames.

Parameters:
bframes -
offset -
size -
skip -
Returns:

loadShoutcastInfo

protected void loadShoutcastInfo(java.io.InputStream input,
                                 java.util.HashMap props)
                          throws java.io.IOException
Load shoutcast (ICY) info.

Parameters:
input -
props -
Throws:
java.io.IOException


JavaZOOM 1999-2005