private byte field_1_blipTypeWin32;
private byte field_2_blipTypeMacOS;
- private byte[] field_3_uid; // 16 bytes
+ private final byte[] field_3_uid = new byte[16];
private short field_4_tag;
private int field_5_size;
private int field_6_ref;
private byte field_11_unused3;
private EscherBlipRecord field_12_blipRecord;
- private byte[] _remainingData;
+ private byte[] _remainingData = new byte[0];
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
int bytesRemaining = readHeader( data, offset );
int pos = offset + 8;
field_1_blipTypeWin32 = data[pos];
field_2_blipTypeMacOS = data[pos + 1];
- field_3_uid = new byte[16];
System.arraycopy( data, pos + 2, field_3_uid, 0, 16 );
field_4_tag = LittleEndian.getShort( data, pos + 18 );
field_5_size = LittleEndian.getInt( data, pos + 20 );
* 16 byte MD4 checksum.
*/
public void setUid(byte[] uid) {
- if (uid != null && uid.length == 16) {
- System.arraycopy(uid, 0, field_3_uid, 0, field_3_uid.length);
- };
+ if (uid == null || uid.length != 16) {
+ throw new IllegalArgumentException("uid must be byte[16]");
+ }
+ System.arraycopy(uid, 0, field_3_uid, 0, field_3_uid.length);
}
/**
*/
public void setRemainingData(byte[] remainingData) {
if (remainingData == null) {
- _remainingData = null;
+ _remainingData = new byte[0];
} else {
_remainingData = remainingData.clone();
}
private static final int HEADER_SIZE = 8;
- private byte[] field_1_UID;
+ private final byte[] field_1_UID = new byte[16];
private byte field_2_marker = (byte) 0xFF;
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
int bytesAfterHeader = readHeader( data, offset );
int pos = offset + HEADER_SIZE;
- field_1_UID = new byte[16];
System.arraycopy( data, pos, field_1_UID, 0, 16 ); pos += 16;
field_2_marker = data[pos]; pos++;
}
public void setUID( byte[] field_1_UID ) {
- if (field_1_UID != null && field_1_UID.length == 16) {
- System.arraycopy(field_1_UID, 0, this.field_1_UID , 0, 16);
+ if (field_1_UID == null || field_1_UID.length != 16) {
+ throw new IllegalArgumentException("field_1_UID must be byte[16]");
}
+ System.arraycopy(field_1_UID, 0, this.field_1_UID , 0, 16);
}
public byte getMarker()
public void setPictureData(byte[] pictureData) {
if (pictureData == null) {
- field_pictureData = null;
- } else {
- field_pictureData = pictureData.clone();
+ throw new NullPointerException("picture data can't be null");
}
+ field_pictureData = pictureData.clone();
}
public String toString() {
private short field_7_dx2;
private short field_8_row2;
private short field_9_dy2;
- private byte[] remainingData;
+ private byte[] remainingData = new byte[0];
private boolean shortRecord = false;
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
*/
public void setRemainingData( byte[] remainingData ) {
if (remainingData == null) {
- this.remainingData = null;
+ this.remainingData = new byte[0];
} else {
this.remainingData = remainingData.clone();
}