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.
format, frameLength, framePos, frameSize| 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(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.
|
protected int |
readBytesFromFloatInput(byte[] abData,
int nOffset,
int nLength)
internal method to read from the underlying InputStream.
Precondition: sourceInput!=null |
protected int |
readBytesFromInputStream(byte[] abData,
int nOffset,
int nLength)
internal method to read from the underlying InputStream.
Precondition: sourceStream!=null |
void |
reset() |
long |
skip(long nSkip) |
getFormat, getFrameLengthpublic FloatInputStream(AudioInputStream sourceStream)
sourceStream - IllegalArgumentException - if the stream's format is not compatiblepublic FloatInputStream(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.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.IllegalArgumentException - if the format is not compatiblepublic void read(FloatSampleBuffer outBuffer)
FloatSampleInputThe buffer's channel count and sample rate may not be changed by the implementation of this method.
read in interface FloatSampleInputoutBuffer - the buffer to be filledpublic void read(FloatSampleBuffer buffer, int offset, int sampleCount)
FloatSampleInputoffset.
The buffer's channel count and sample rate may not be changed by the implementation of this method.
read in interface FloatSampleInputbuffer - 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 FloatSampleInputpublic float getSampleRate()
getSampleRate in interface FloatSampleInputpublic boolean isDone()
FloatSampleInputisDone in interface FloatSampleInputpublic int read()
throws IOException
read in class AudioInputStreamIOExceptionpublic int read(byte[] abData)
throws IOException
read in class AudioInputStreamIOExceptionread(byte[], int, int)public int read(byte[] abData,
int nOffset,
int nLength)
throws IOException
read in class AudioInputStreamIOExceptionprotected int readBytesFromInputStream(byte[] abData,
int nOffset,
int nLength)
throws IOException
IOExceptionprotected int readBytesFromFloatInput(byte[] abData,
int nOffset,
int nLength)
throws IOException
abData - the byte array to fill, or null if just skippingIOExceptionpublic long skip(long nSkip)
throws IOException
skip in class AudioInputStreamIOExceptionpublic int available()
throws IOException
available in class AudioInputStreamIOExceptionpublic void mark(int readlimit)
mark in class AudioInputStreampublic void reset()
throws IOException
reset in class AudioInputStreamIOExceptionpublic boolean markSupported()
markSupported in class AudioInputStreampublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class AudioInputStreamIOExceptionCopyright © 2016. All Rights Reserved.