Interface AudioDecoder
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AudioInputStreamDecoder,ExternalDecoder,FlacDecoder,OpusDecoder,PcmChannelDecoder,VorbisDecoder
Interface for streamed audio decoding. Each decoder has a
AudioDecoder.Target, which receives decoded
metadata and PCM audio.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface that can be implemented by decoder in order to receive pictures embedded in the decoded file metadata.static interfaceInterface for the destination of an audio decoder. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()SeeCloseable.close().booleandecodeAll(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).voidDecodes metadata and sends it to the target, without writing any blocks.default Stringquality()Returns a string to indicate compression quality, or empty string for lossless formats (the default).booleanreusable()True ifdecodeAll(long)can be called more than once, each time resetting the underlying input.
-
Method Details
-
reusable
boolean reusable()True ifdecodeAll(long)can be called more than once, each time resetting the underlying input. -
decodeMetadata
Decodes metadata and sends it to the target, without writing any blocks. Must be called at most once, and never afterdecodeAll. If this is not called, metadata gets sent to the target bydecodeAll.- Throws:
IOException
-
decodeAll
Sends audio data to the target, one block at the time, starting from the given sample frame (zero to start at the beginning). IfdecodeMetadata()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 isreusable(),decodeAllmay be called again to once more decode part of the same file.- Throws:
IOException
-
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
SeeCloseable.close().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-