Class DecoderAudioInputStream

java.lang.Object
java.io.InputStream
javax.sound.sampled.AudioInputStream
net.avadeaux.klipspringer.codec.spi.DecoderAudioInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class DecoderAudioInputStream extends AudioInputStream
Wrapper for AudioDecoder to make it readable as an AudioInputStream
  • Method Details

    • setThreadFactory

      public static ThreadFactory setThreadFactory(ThreadFactory fact)
      Sets global thread factory for feeder threads, returning the previous factory. This allows, for instance, controlling what happens on uncaught throwables (such as Error, because RuntimeExceptions are caught and transferred to the client thread). By default, an uncaught throwable prints an error and exits the process.
    • close

      public void close() throws IOException
      Closes the stream, causing decoding to be aborted and the feeder thread to finish.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class AudioInputStream
      Throws:
      IOException
    • read

      public int read() throws IOException
      Overrides:
      read in class AudioInputStream
      Throws:
      IOException
    • read

      public int read(byte[] b, int off, int n) throws IOException
      Overrides:
      read in class AudioInputStream
      Throws:
      IOException
    • read

      public int read(byte[] b) throws IOException
      Overrides:
      read in class AudioInputStream
      Throws:
      IOException
    • skip

      public long skip(long n) throws IOException
      Skips ahead the given number of bytes in the stream. If any data have been read from from the stream using the currently active decoder, the decoding process is aborted and a new decoder is created starting from the desired position. This method can be combined with reset() in order to seek to an arbitrary position in the file. Returns the number of bytes actually skipped, which is at most to the end of the stream, and rounded down to the nearest integral number of frames.
      Overrides:
      skip in class AudioInputStream
      Throws:
      IOException
    • available

      public int available() throws IOException
      Overrides:
      available in class AudioInputStream
      Throws:
      IOException
    • markSupported

      public boolean markSupported()
      Returns true.
      Overrides:
      markSupported in class AudioInputStream
    • mark

      public void mark(int ignoredReadLimit)
      Remembers the current position for a later reset. The specified read limit is ignored. By default, the beginning of the input is marked.
      Overrides:
      mark in class AudioInputStream
    • reset

      public void reset() throws IOException
      Resets the stream to the marked position, or to the beginning if mark() has not been called. If any data have been read from from the stream using the currently active decoder, the decoding process is aborted and a new decoder is created starting from the desired position. This method can be combined with skip() in order to seek to an arbitrary position in the file.
      Overrides:
      reset in class AudioInputStream
      Throws:
      IOException