public class Sample
extends java.lang.Object
Constructor and Description |
---|
Sample(java.io.BufferedReader reader,
int numChannels)
Reads a sample from the input reader.
|
Sample(short[] frameData,
byte[] residualData)
Constructs a RELP Sample from its component parts
|
Sample(short[] frameData,
byte[] residualData,
int residualSize)
Constructs a Sample from its component parts
|
Modifier and Type | Method and Description |
---|---|
boolean |
compare(Sample other)
Compares two samples.
|
void |
dump()
Dumps the sample:
|
void |
dumpBinary(java.nio.ByteBuffer bb)
Dumps the samples to the given ByteBuffer
|
void |
dumpBinary(java.io.DataOutputStream os)
Dumps the samples to the given stream
|
short[] |
getFrameData()
Gets the frame data associated with this sample
|
int |
getFrameData(int which)
Returns the normalized frame data.
|
byte[] |
getResidualData()
Gets the residual data associated with this sample
|
int |
getResidualData(int which)
Returns the normalized residual data.
|
int |
getResidualSize()
Returns the number of residuals in this Sample.
|
static Sample |
loadBinary(java.nio.ByteBuffer bb)
Loads the samples from the byte bufer
|
static Sample |
loadBinary(java.io.DataInputStream dis)
Loads the samples from the given channel
|
public Sample(short[] frameData, byte[] residualData)
frameData
- the framedataresidualData
- the residual datapublic Sample(short[] frameData, byte[] residualData, int residualSize)
frameData
- the framedataresidualData
- the residual datapublic Sample(java.io.BufferedReader reader, int numChannels)
reader
- the input reader to read the data fromnumChannels
- the number of channels per framepublic short[] getFrameData()
public byte[] getResidualData()
public int getResidualSize()
public int getResidualData(int which)
which
- the index of the data of interestpublic int getFrameData(int which)
which
- the index of the data of interestpublic void dump()
public void dumpBinary(java.nio.ByteBuffer bb) throws java.io.IOException
bb
- the ByteBuffer to write the data to.java.io.IOException
- if IO error occurspublic void dumpBinary(java.io.DataOutputStream os) throws java.io.IOException
os
- the DataOutputStream to write the data to.java.io.IOException
- if IO error occurspublic static Sample loadBinary(java.nio.ByteBuffer bb) throws java.io.IOException
bb
- the byte buffer to read the data from.java.io.IOException
- if IO error occurspublic static Sample loadBinary(java.io.DataInputStream dis) throws java.io.IOException
dis
- the DataInputStream to read the data from.java.io.IOException
- if IO error occurspublic boolean compare(Sample other)
other
- the other sample to compare this one totrue
if they compare; otherwise
false