public class FloatInputStream extends AudioInputStream implements FloatSampleInput
All calls to FloatSampleInput.read() will cause implicit conversion to FloatSampleBuffer. If the underlying stream implementes FloatSampleInput, the FloatSampleInput.read method is used for reading.
Constructor and Description |
---|
FloatInputStream(AudioInputStream sourceStream)
Create a new FloatInputStream that shadows the sourceStream.
|
FloatInputStream(FloatSampleInput sourceInput,
AudioFormat format,
long frameLength)
Create a new FloatInputStream that will make the specified
FloatSampleInput a complete AudioInputStream.
|
FloatInputStream(java.io.InputStream sourceStream,
AudioFormat format,
long frameLength)
Create a new FloatInputStream that shadows the sourceStream.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
int |
getChannels() |
float |
getSampleRate() |
boolean |
isDone()
Determine if this stream has reached its end.
|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] abData) |
int |
read(byte[] abData,
int nOffset,
int nLength)
If an underlying InputStream is available, read from it, otherwise read
from an underlying FloatSampleInput stream and convert to a byte array.
|
void |
read(FloatSampleBuffer outBuffer)
Fill the entire buffer with audio data.
|
void |
read(FloatSampleBuffer buffer,
int offset,
int sampleCount)
Fill the specified portion of the buffer with the next audio data to be
read.
|
void |
reset() |
long |
skip(long nSkip) |
getFormat, getFrameLength
public FloatInputStream(AudioInputStream sourceStream)
sourceStream
- java.lang.IllegalArgumentException
- if the stream's format is not compatiblepublic FloatInputStream(java.io.InputStream sourceStream, AudioFormat format, long frameLength)
sourceStream
- format
- the native format of sourceStreamframeLength
- the length in frames of the streams, or
AudioSystem.NOT_SPECIFIED if not known or unlimited.java.lang.IllegalArgumentException
- if the stream's format is not compatiblepublic FloatInputStream(FloatSampleInput sourceInput, AudioFormat format, long frameLength)
sourceInput
- format
- the native format for the read(byte[]) methodframeLength
- the length in frames of the stream, or
AudioSystem.NOT_SPECIFIED if not known or unlimited.java.lang.IllegalArgumentException
- if the format is not compatiblepublic void read(FloatSampleBuffer outBuffer)
FloatSampleInput
The buffer's channel count and sample rate may not be changed by the implementation of this method.
read
in interface FloatSampleInput
outBuffer
- the buffer to be filledpublic void read(FloatSampleBuffer buffer, int offset, int sampleCount)
FloatSampleInput
offset
.
The buffer's channel count and sample rate may not be changed by the implementation of this method.
read
in interface FloatSampleInput
buffer
- the buffer to be filledoffset
- the start index, in samples, where to start filling the
buffersampleCount
- the number fo samples to fill into the bufferpublic int getChannels()
getChannels
in interface FloatSampleInput
public float getSampleRate()
getSampleRate
in interface FloatSampleInput
public boolean isDone()
FloatSampleInput
isDone
in interface FloatSampleInput
public int read() throws java.io.IOException
read
in class AudioInputStream
java.io.IOException
public int read(byte[] abData) throws java.io.IOException
read
in class AudioInputStream
java.io.IOException
read(byte[], int, int)
public int read(byte[] abData, int nOffset, int nLength) throws java.io.IOException
read
in class AudioInputStream
java.io.IOException
public long skip(long nSkip) throws java.io.IOException
skip
in class AudioInputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class AudioInputStream
java.io.IOException
public void mark(int readlimit)
mark
in class AudioInputStream
public void reset() throws java.io.IOException
reset
in class AudioInputStream
java.io.IOException
public boolean markSupported()
markSupported
in class AudioInputStream
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class AudioInputStream
java.io.IOException