|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarytts.unitselection.data.Datagram
public class Datagram
| Field Summary | |
|---|---|
protected byte[] |
data
The datagram's contents, as a generic byte array. |
protected long |
duration
The datagram duration, in samples. |
static int |
NUM_HEADER_BYTES
|
| Constructor Summary | |
|---|---|
|
Datagram(java.nio.ByteBuffer bb)
Constructor which reads a datagram from a byte buffer. |
|
Datagram(java.nio.ByteBuffer bb,
boolean readData)
Constructor which reads a datagram from a byte buffer. |
protected |
Datagram(long duration)
Constructor for subclasses which want to represent data in a different format. |
|
Datagram(long setDuration,
byte[] setData)
Constructor from external data. |
|
Datagram(java.io.RandomAccessFile raf)
Constructor which reads a datagram from a random access file. |
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
Tests if this datagram is equal to another datagram. |
byte[] |
getData()
Get the datagram's data field. |
long |
getDuration()
Get the datagram duration, in samples. |
int |
getLength()
Get the length, in bytes, of the datagram's data field. |
void |
setDuration(long setDuration)
Set the new duration. |
void |
write(java.io.DataOutput raf)
Write this datagram to a random access file or data output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NUM_HEADER_BYTES
protected long duration
protected byte[] data
| Constructor Detail |
|---|
protected Datagram(long duration)
setDuration - the datagram duration, in samples. Must be non-negative.
java.lang.IllegalArgumentException - if duration is negative
public Datagram(long setDuration,
byte[] setData)
setDuration - the datagram duration, in samples. Must be non-negative.setBuff - the byte buffer to use as the datagram's data field. Must not be null.
java.lang.IllegalArgumentException - if duration is negative
java.lang.NullPointerException - if setData is null.
public Datagram(java.io.RandomAccessFile raf)
throws java.io.IOException
raf - the random access file to read the datagram from.
java.io.IOException - if there is a problem initialising the datagram from the file
public Datagram(java.nio.ByteBuffer bb)
throws java.io.IOException
bb - the byte buffer to read the datagram from.
java.io.IOException - if the datagram has wrong format or if the datagram cannot be fully read
public Datagram(java.nio.ByteBuffer bb,
boolean readData)
throws java.io.IOException
bb - the byte buffer to read the datagram from.readData - whether to try and read the actual data
java.io.IOException - if the datagram has wrong format or if the datagram cannot be fully read| Method Detail |
|---|
public void setDuration(long setDuration)
setDuration - the datagram duration, in samples. Must be non-negative.
java.lang.IllegalArgumentException - if duration is negative
public void write(java.io.DataOutput raf)
throws java.io.IOException
raf - the data output to write to.
java.lang.IllegalStateException - if called when data is null.
java.io.IOException - if a write error occurs.public long getDuration()
public int getLength()
java.lang.IllegalStateException - if called when data is null.public byte[] getData()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||