/** * Creates a new ObjectNumberHashMap datatype. * * @param identifier * @param frameBody * @param size * @throws IllegalArgumentException */ public NumberHashMap(String identifier, AbstractTagFrameBody frameBody, int size) { super(identifier, frameBody, size); if (identifier.equals(DataTypes.OBJ_GENRE)) { valueToKey = GenreTypes.getInstanceOf().getValueToIdMap(); keyToValue = GenreTypes.getInstanceOf().getIdToValueMap(); // genres can be an id or literal value hasEmptyValue = true; } else if (identifier.equals(DataTypes.OBJ_TEXT_ENCODING)) { valueToKey = TextEncoding.getInstanceOf().getValueToIdMap(); keyToValue = TextEncoding.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_INTERPOLATION_METHOD)) { valueToKey = InterpolationTypes.getInstanceOf().getValueToIdMap(); keyToValue = InterpolationTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_PICTURE_TYPE)) { valueToKey = PictureTypes.getInstanceOf().getValueToIdMap(); keyToValue = PictureTypes.getInstanceOf().getIdToValueMap(); // Issue #224 Values should map, but have examples where they dont, this is a workaround hasEmptyValue = true; } else if (identifier.equals(DataTypes.OBJ_TYPE_OF_EVENT)) { valueToKey = EventTimingTypes.getInstanceOf().getValueToIdMap(); keyToValue = EventTimingTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_TIME_STAMP_FORMAT)) { valueToKey = EventTimingTimestampTypes.getInstanceOf().getValueToIdMap(); keyToValue = EventTimingTimestampTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_TYPE_OF_CHANNEL)) { valueToKey = ChannelTypes.getInstanceOf().getValueToIdMap(); keyToValue = ChannelTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_RECIEVED_AS)) { valueToKey = ReceivedAsTypes.getInstanceOf().getValueToIdMap(); keyToValue = ReceivedAsTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_CONTENT_TYPE)) { valueToKey = SynchronisedLyricsContentType.getInstanceOf().getValueToIdMap(); keyToValue = SynchronisedLyricsContentType.getInstanceOf().getIdToValueMap(); } else { throw new IllegalArgumentException( "Hashmap identifier not defined in this class: " + identifier); } }
/** * Get the text encoding being used. * * <p>The text encoding is defined by the frame body that the text field belongs to. * * @return the text encoding charset */ protected String getTextEncodingCharSet() { byte textEncoding = this.getBody().getTextEncoding(); String charSetName = TextEncoding.getInstanceOf().getValueForId(textEncoding); logger.finest("text encoding:" + textEncoding + " charset:" + charSetName); return charSetName; }