/** * */ protected void setupObjectList() { objectList.add(new NumberFixedLength(DataTypes.OBJ_OFFSET, this, 4)); } }
@Override public void readByteArray(final byte[] buffer, final int originalOffset) throws InvalidDataTypeException { int localOffset = originalOffset; int size = getSize(); logger.finest("offset:" + localOffset); //The read has extended further than the defined frame size (ok to extend upto //size because the next datatype may be of length 0.) if (originalOffset > buffer.length-size) { logger.warning("Invalid size for FrameBody"); throw new InvalidDataTypeException("Invalid size for FrameBody"); } this.type.readByteArray(buffer, localOffset); localOffset += this.type.getSize(); this.timestamp.readByteArray(buffer, localOffset); localOffset += this.timestamp.getSize(); }
/** * @param obj * @return */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof NumberHashMap)) { return false; } NumberHashMap that = (NumberHashMap) obj; return EqualsUtil.areEqual(hasEmptyValue, that.hasEmptyValue) && EqualsUtil.areEqual(keyToValue, that.keyToValue) && EqualsUtil.areEqual(valueToKey, that.valueToKey) && super.equals(that); }
/** * Read the key from the buffer. * * @param arr * @param offset * @throws InvalidDataTypeException if emptyValues are not allowed and the eky was invalid. */ public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { super.readByteArray(arr, offset); //Mismatch:Superclass uses Long, but maps expect Integer Integer intValue = ((Long) value).intValue(); if (!keyToValue.containsKey(intValue)) { if (!hasEmptyValue) { throw new InvalidDataTypeException(ErrorMessage.MP3_REFERENCE_KEY_INVALID.getMsg(identifier, intValue)); } else if (identifier.equals(DataTypes.OBJ_PICTURE_TYPE)) { //logger.warning(ErrorMessage.MP3_PICTURE_TYPE_INVALID.getMsg(value)); } } }
public void setTimestamp(final long timestamp) { this.timestamp.setValue(timestamp); }
@Override public void setBody(final AbstractTagFrameBody frameBody) { super.setBody(frameBody); this.type.setBody(frameBody); this.timestamp.setBody(frameBody); }
@Override public byte[] writeByteArray() { final byte[] typeData = this.tempo.writeByteArray(); final byte[] timeData = this.timestamp.writeByteArray(); if (typeData == null || timeData == null) return null; final byte[] objectData = new byte[typeData.length + timeData.length]; System.arraycopy(typeData, 0, objectData, 0, typeData.length); System.arraycopy(timeData, 0, objectData, typeData.length, timeData.length); return objectData; }
public long getTimestamp() { return ((Number)timestamp.getValue()).longValue(); }
@Override public int getSize() { return this.tempo.getSize() + this.timestamp.getSize(); }
@Override public void readByteArray(final byte[] buffer, final int originalOffset) throws InvalidDataTypeException { int localOffset = originalOffset; int size = getSize(); logger.finest("offset:" + localOffset); //The read has extended further than the defined frame size (ok to extend upto //size because the next datatype may be of length 0.) if (originalOffset > buffer.length-size) { logger.warning("Invalid size for FrameBody"); throw new InvalidDataTypeException("Invalid size for FrameBody"); } this.tempo.readByteArray(buffer, localOffset); localOffset += this.tempo.getSize(); this.timestamp.readByteArray(buffer, localOffset); localOffset += this.timestamp.getSize(); }
/** * @param obj * @return */ public boolean equals(Object obj) { if(obj==this) { return true; } if (!(obj instanceof NumberHashMap)) { return false; } NumberHashMap that = (NumberHashMap) obj; return EqualsUtil.areEqual(hasEmptyValue, that.hasEmptyValue) && EqualsUtil.areEqual(keyToValue, that.keyToValue) && EqualsUtil.areEqual(valueToKey, that.valueToKey) && super.equals(that); }
/** * Read the key from the buffer. * * @param arr * @param offset * @throws InvalidDataTypeException if emptyValues are not allowed and the eky was invalid. */ public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { super.readByteArray(arr, offset); //Mismatch:Superclass uses Long, but maps expect Integer Integer intValue = ((Long) value).intValue(); if (!keyToValue.containsKey(intValue)) { if (!hasEmptyValue) { throw new InvalidDataTypeException(ErrorMessage.MP3_REFERENCE_KEY_INVALID.getMsg(identifier, intValue)); } else if (identifier.equals(DataTypes.OBJ_PICTURE_TYPE)) { logger.warning(ErrorMessage.MP3_PICTURE_TYPE_INVALID.getMsg(value)); } } }
public void setTimestamp(final long timestamp) { this.timestamp.setValue(timestamp); }
@Override public void setBody(final AbstractTagFrameBody frameBody) { super.setBody(frameBody); this.tempo.setBody(frameBody); this.timestamp.setBody(frameBody); }
@Override public byte[] writeByteArray() { final byte[] typeData = this.type.writeByteArray(); final byte[] timeData = this.timestamp.writeByteArray(); if (typeData == null || timeData == null) return null; final byte[] objectData = new byte[typeData.length + timeData.length]; System.arraycopy(typeData, 0, objectData, 0, typeData.length); System.arraycopy(timeData, 0, objectData, typeData.length, timeData.length); return objectData; }
public long getTimestamp() { return ((Number)timestamp.getValue()).longValue(); }
/** * */ protected void setupObjectList() { objectList.add(new NumberFixedLength(DataTypes.OBJ_OFFSET, this, 4)); } }
/** * @param obj * @return */ public boolean equals(Object obj) { if(obj==this) { return true; } if (!(obj instanceof NumberHashMap)) { return false; } NumberHashMap that = (NumberHashMap) obj; return EqualsUtil.areEqual(hasEmptyValue, that.hasEmptyValue) && EqualsUtil.areEqual(keyToValue, that.keyToValue) && EqualsUtil.areEqual(valueToKey, that.valueToKey) && super.equals(that); }
/** * Read the key from the buffer. * * @param arr * @param offset * @throws InvalidDataTypeException if emptyValues are not allowed and the eky was invalid. */ public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { super.readByteArray(arr, offset); //Mismatch:Superclass uses Long, but maps expect Integer Integer intValue = ((Long) value).intValue(); if (!keyToValue.containsKey(intValue)) { if (!hasEmptyValue) { throw new InvalidDataTypeException(ErrorMessage.MP3_REFERENCE_KEY_INVALID.getMsg(identifier, intValue)); } else if (identifier.equals(DataTypes.OBJ_PICTURE_TYPE)) { logger.warning(ErrorMessage.MP3_PICTURE_TYPE_INVALID.getMsg(value)); } } }