Class MP3AudioInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public class MP3AudioInputStream extends AudioInputStream
AudioInputStream adapter for MP3ElementaryInputStream.

Unlike a regular audio input stream, an MP3 audio input stream can have a variable frame size and can change its encoding method in mid-stream. Therefore method getFormat can return different values for each frame, and mark/reset is not supported, and method getFrameLength can not return the total number of frames in the stream.

Author:
Werner Randelshofer
  • Constructor Details

    • MP3AudioInputStream

      public MP3AudioInputStream(File file) throws IOException
      Creates an MP3AudioInputStream and reads the stream until the first frame is reached.
      Parameters:
      file - A File.
      Throws:
      IOException - if the file does not contain an MP3 elementary stream.
    • MP3AudioInputStream

      public MP3AudioInputStream(InputStream in) throws IOException
      Creates an MP3AudioInputStream and reads the stream until the first frame is reached.
      Parameters:
      in - An InputStream.
      Throws:
      IOException - if the stream does not contain an MP3 elementary stream.
  • Method Details