Package be.tarsos.dsp.io
Class UniversalAudioInputStream
java.lang.Object
be.tarsos.dsp.io.UniversalAudioInputStream
- All Implemented Interfaces:
TarsosDSPAudioInputStream
public class UniversalAudioInputStream extends java.lang.Object implements TarsosDSPAudioInputStream
-
Constructor Summary
Constructors Constructor Description UniversalAudioInputStream(java.io.InputStream underlyingInputStream, TarsosDSPAudioFormat format)
-
Method Summary
Modifier and Type Method Description void
close()
Closes this audio input stream and releases any system resources associated with the stream.TarsosDSPAudioFormat
getFormat()
long
getFrameLength()
int
read(byte[] b, int off, int len)
Reads up to a specified maximum number of bytes of data from the audio stream, putting them into the given byte array.long
skip(long bytesToSkip)
Skip a number of bytes before reading the remaining bytes.
-
Constructor Details
-
UniversalAudioInputStream
public UniversalAudioInputStream(java.io.InputStream underlyingInputStream, TarsosDSPAudioFormat format)
-
-
Method Details
-
skip
public long skip(long bytesToSkip) throws java.io.IOExceptionDescription copied from interface:TarsosDSPAudioInputStream
Skip a number of bytes before reading the remaining bytes.- Specified by:
skip
in interfaceTarsosDSPAudioInputStream
- Parameters:
bytesToSkip
- The number of bytes to skip.- Returns:
- The number of bytes skipped.
- Throws:
java.io.IOException
- If the underlying if an input or output error occurs #see read
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionDescription copied from interface:TarsosDSPAudioInputStream
Reads up to a specified maximum number of bytes of data from the audio stream, putting them into the given byte array.This method will always read an integral number of frames. If
len
does not specify an integral number of frames, a maximum oflen - (len % frameSize)
bytes will be read.- Specified by:
read
in interfaceTarsosDSPAudioInputStream
- Parameters:
b
- the buffer into which the data is readoff
- the offset, from the beginning of arrayb
, at which the data will be writtenlen
- the maximum number of bytes to read- Returns:
- the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
- Throws:
java.io.IOException
- if an input or output error occurs- See Also:
TarsosDSPAudioInputStream.skip(long)
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:TarsosDSPAudioInputStream
Closes this audio input stream and releases any system resources associated with the stream.- Specified by:
close
in interfaceTarsosDSPAudioInputStream
- Throws:
java.io.IOException
- if an input or output error occurs
-
getFormat
- Specified by:
getFormat
in interfaceTarsosDSPAudioInputStream
- Returns:
- The format of the underlying audio
-
getFrameLength
public long getFrameLength()- Specified by:
getFrameLength
in interfaceTarsosDSPAudioInputStream
-