public class DDSAudioInputStream extends AudioInputStream
Modifier and Type | Field and Description |
---|---|
static int |
MAX_AMPLITUDE |
protected double[] |
sampleBuf |
protected static int |
SAMPLEBUFFERSIZE |
protected DoubleDataSource |
source |
format, frameLength, framePos, frameSize
Constructor and Description |
---|
DDSAudioInputStream(DoubleDataSource source,
AudioFormat format)
From the given DoubleDataSource, create an AudioInputStream of the given audio format.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns the maximum number of bytes that can be read (or skipped over) from this audio input stream without blocking.
|
void |
close()
Closes this audio input stream and releases any system resources associated with the stream.
|
long |
getFrameLength() |
void |
mark(int readlimit)
Marks the current position in this audio input stream.
|
boolean |
markSupported()
Tests whether this audio input stream supports the
mark and reset methods. |
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.
|
void |
reset()
Repositions this audio input stream to the position it had at the time its
mark method was last invoked. |
long |
skip(long n)
Skips over and discards a specified number of bytes from this audio input stream.
|
getFormat, read, read
public static final int MAX_AMPLITUDE
protected DoubleDataSource source
protected double[] sampleBuf
protected static final int SAMPLEBUFFERSIZE
public DDSAudioInputStream(DoubleDataSource source, AudioFormat format)
source
- sourceformat
- formatIllegalArgumentException
- if the format is not mono, not PCM_SIGNED or PCM_UNSIGNED, or has a sample size in bits other than 8 or 16.public int read(byte[] b, int off, int len) throws IOException
This method will always read an integral number of frames. If len
does not specify an integral number of
frames, a maximum of len - (len % frameSize)
bytes will be read.
read
in class AudioInputStream
b
- the buffer into which the data is readoff
- the offset, from the beginning of array b
, at which the data will be writtenlen
- the maximum number of bytes to readIOException
- if an input or output error occursAudioInputStream.read(byte[])
,
AudioInputStream.read()
,
skip(long)
,
available()
public long skip(long n) throws IOException
skip
in class AudioInputStream
n
- the requested number of bytes to be skippedIOException
- if an input or output error occursread(byte[], int, int)
,
available()
public int available() throws IOException
read
or skip
method for this audio input stream;
the limit can vary each time these methods are invoked. Depending on the underlying stream,an IOException may be thrown if
this stream is closed.available
in class AudioInputStream
IOException
- if an input or output error occursread(byte[], int, int)
,
AudioInputStream.read(byte[])
,
AudioInputStream.read()
,
skip(long)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class AudioInputStream
IOException
- if an input or output error occurspublic void mark(int readlimit)
mark
in class AudioInputStream
readlimit
- the maximum number of bytes that can be read before the mark position becomes invalid.reset()
,
markSupported()
public void reset() throws IOException
mark
method was last invoked.reset
in class AudioInputStream
IOException
- if an input or output error occurs.mark(int)
,
markSupported()
public boolean markSupported()
mark
and reset
methods.markSupported
in class AudioInputStream
true
if this stream supports the mark
and reset
methods; false
otherwisemark(int)
,
reset()
public long getFrameLength()
getFrameLength
in class AudioInputStream
Copyright © 2000–2016 DFKI GmbH. All rights reserved.