com.virtuosotechnologies.asaph.model
Interface BinaryData

All Superinterfaces:
SongMember
All Known Subinterfaces:
BinaryField

public interface BinaryData
extends SongMember

Binary byte array SongMember


Method Summary
 String getDataType()
          Get the type of the data.
 int getLength()
          Get the length of the value
 byte[] getRange(int start, int length, byte[] destination, int pos)
          Get a range of the value as a byte array.
 byte[] getValue()
          Get a copy of the value as a byte array.
 void setDataType(String type, UndoableEditListener undoListener)
          Set the type of the data
 void setLength(int length, UndoableEditListener undoListener)
          Set the length of the value.
 void setRange(int start, int length, byte[] source, int pos, UndoableEditListener undoListener)
          Set a range of the value.
 void setValue(byte[] value, UndoableEditListener undoListener)
          Set the value as a byte array.
 
Methods inherited from interface com.virtuosotechnologies.asaph.model.SongMember
getSong, isDefunct
 

Method Detail

getDataType

public String getDataType()
Get the type of the data.

Returns:
the name

setDataType

public void setDataType(String type,
                        UndoableEditListener undoListener)
Set the type of the data

Parameters:
type - new data type
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits

getValue

public byte[] getValue()
Get a copy of the value as a byte array. Allocates a new byte array and populates it with a copy of the entire value.

Returns:
the value of the field as a byte array

getRange

public byte[] getRange(int start,
                       int length,
                       byte[] destination,
                       int pos)
Get a range of the value as a byte array. The caller may optionally specify a destination array to fill, otherwise, this method will allocate a new array and populate it with a copy of the requested range.

Parameters:
start - the starting position in the value
length - the length of the range to get. Pass -1 to get to the end of the value.
destination - destination array to populate with the result. If null is passed, getRange allocates a new array the size of the requested range.
pos - position in the destination array for the start of the data. Ignored if destination is null.
Returns:
the destination array, if specified, otherwise, the newly allocated array.
Throws:
IndexOutOfBoundsException - start+length was greater than the length of the value, or the requested range would overflow the destination array.

getLength

public int getLength()
Get the length of the value

Returns:
length in bytes

setValue

public void setValue(byte[] value,
                     UndoableEditListener undoListener)
Set the value as a byte array. Completely replaces the old value with the new value, possibly also changing the length.

Parameters:
value - the value of the field as a byte array
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits

setRange

public void setRange(int start,
                     int length,
                     byte[] source,
                     int pos,
                     UndoableEditListener undoListener)
Set a range of the value.

Parameters:
start - starting position in the value
length - the length of the range to change.
source - source byte array
pos - starting position in the source array
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits
Throws:
IndexOutOfBoundsException - pos+length was greater than the length of the source, start+length was greater than the length of the field value.

setLength

public void setLength(int length,
                      UndoableEditListener undoListener)
Set the length of the value. If the new length is less than the old length, truncates the value. If the new length is greater than the old length, the added bytes are undefined.

Parameters:
length - length in bytes
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits