Class DecoderAudioInputStream
java.lang.Object
java.io.InputStream
javax.sound.sampled.AudioInputStream
net.avadeaux.klipspringer.codec.spi.DecoderAudioInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Wrapper for
AudioDecoder to make it readable as an AudioInputStream-
Field Summary
Fields inherited from class javax.sound.sampled.AudioInputStream
format, frameLength, framePos, frameSize -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()Closes the stream, causing decoding to be aborted and the feeder thread to finish.voidmark(int ignoredReadLimit) Remembers the current position for a later reset.booleanReturns true.intread()intread(byte[] b) intread(byte[] b, int off, int n) voidreset()Resets the stream to the marked position, or to the beginning if mark() has not been called.static ThreadFactorySets global thread factory for feeder threads, returning the previous factory.longskip(long n) Skips ahead the given number of bytes in the stream.Methods inherited from class javax.sound.sampled.AudioInputStream
getFormat, getFrameLengthMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
setThreadFactory
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
Closes the stream, causing decoding to be aborted and the feeder thread to finish.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAudioInputStream- Throws:
IOException
-
read
- Overrides:
readin classAudioInputStream- Throws:
IOException
-
read
- Overrides:
readin classAudioInputStream- Throws:
IOException
-
read
- Overrides:
readin classAudioInputStream- Throws:
IOException
-
skip
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:
skipin classAudioInputStream- Throws:
IOException
-
available
- Overrides:
availablein classAudioInputStream- Throws:
IOException
-
markSupported
-
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:
markin classAudioInputStream
-
reset
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:
resetin classAudioInputStream- Throws:
IOException
-