Class FlacDecoder

java.lang.Object
net.avadeaux.klipspringer.decoder.FlacDecoder
All Implemented Interfaces:
Closeable, AutoCloseable, AudioDecoder

public class FlacDecoder extends Object implements AudioDecoder
Class that interfaces to FLAC library for decoding.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.avadeaux.klipspringer.decoder.AudioDecoder

    AudioDecoder.Target
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initiates decoder, including opening the file.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes decoder, releasing resources.
    boolean
    decodeAll(long fromSampleNo)
    Sends audio data to the target, one block at the time, starting from the given sample frame number (zero to start at the beginning).
    void
    Decodes metadata and sends it to the target, without writing any blocks.
    boolean
    Always returns true, indicating that decodeAll can be called more than once, each time resetting the underlying input.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • reusable

      public boolean reusable()
      Always returns true, indicating that decodeAll can be called more than once, each time resetting the underlying input.
      Specified by:
      reusable in interface AudioDecoder
    • close

      public void close() throws IOException
      Description copied from interface: AudioDecoder
      Closes decoder, releasing resources. The decoder is automatically closed if decoding throws an exception. Closing on an already closed or terminated decoder has no effect.
      Specified by:
      close in interface AudioDecoder
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • decodeMetadata

      public void decodeMetadata() throws IOException
      Description copied from interface: AudioDecoder
      Decodes metadata and sends it to the target, without writing any blocks. Should be called at most once, and never after decodeAll. If not called, metadata gets sent to the target by decodeAll.
      Specified by:
      decodeMetadata in interface AudioDecoder
      Throws:
      IOException
    • decodeAll

      public boolean decodeAll(long fromSampleNo) throws IOException
      Description copied from interface: AudioDecoder
      Sends audio data to the target, one block at the time, starting from the given sample frame number (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 AudioDecoder.reusable(), decodeAll may be called again to decode the same input once more. It must not be called again if decoding has thrown an exception.
      Specified by:
      decodeAll in interface AudioDecoder
      Throws:
      IOException