Class MpegAudioFileReader


  • public class MpegAudioFileReader
    extends TAudioFileReader
    This class implements AudioFileReader for MP3 SPI.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INITAL_READ_LENGTH

        public static int INITAL_READ_LENGTH
    • 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.
        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.
        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.
        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.
        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.
        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.
        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