Interface AudioDecoder

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AudioInputStreamDecoder, ExternalDecoder, FlacDecoder, OpusDecoder, PcmChannelDecoder, VorbisDecoder

public interface AudioDecoder extends Closeable
Interface for streamed audio decoding. Each decoder has a AudioDecoder.Target, which receives decoded metadata and PCM audio.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Interface that can be implemented by decoder in order to receive pictures embedded in the decoded file metadata.
    static interface 
    Interface for the destination of an audio decoder.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    boolean
    decodeAll(long fromFrame)
    Sends audio data to the target, one block at the time, starting from the given sample frame (zero to start at the beginning).
    void
    Decodes metadata and sends it to the target, without writing any blocks.
    default String
    Returns a string to indicate compression quality, or empty string for lossless formats (the default).
    boolean
    True if decodeAll(long) can be called more than once, each time resetting the underlying input.
  • Method Details

    • reusable

      boolean reusable()
      True if decodeAll(long) can be called more than once, each time resetting the underlying input.
    • decodeMetadata

      void decodeMetadata() throws IOException
      Decodes metadata and sends it to the target, without writing any blocks. Must be called at most once, and never after decodeAll. If this is not called, metadata gets sent to the target by decodeAll.
      Throws:
      IOException
    • decodeAll

      boolean decodeAll(long fromFrame) throws IOException
      Sends audio data to the target, one block at the time, starting from the given sample frame (zero to start at the beginning). If decodeMetadata() has not been called, metadata is sent to the target before the first block. Returns when the input is exhausted (in which case it returns true) or the target aborts decoding by returning false from write (in which case this method returns false). In either case, if this decoder is reusable(), decodeAll may be called again to once more decode part of the same file.
      Throws:
      IOException
    • quality

      default String quality()
      Returns a string to indicate compression quality, or empty string for lossless formats (the default). The string may contain a numeric value for the quality or simply indicate that it is (lossily) compressed.
    • close

      void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException