| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FrameBodyUnsupported |
|
| 1.4;1.4 |
| 1 | /** | |
| 2 | * @author : Paul Taylor | |
| 3 | * @author : Eric Farng | |
| 4 | * | |
| 5 | * Version @version:$Id: FrameBodyUnsupported.java,v 1.16 2008/07/21 10:45:46 paultaylor Exp $ | |
| 6 | * | |
| 7 | * MusicTag Copyright (C)2003,2004 | |
| 8 | * | |
| 9 | * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser | |
| 10 | * General Public License as published by the Free Software Foundation; either version 2.1 of the License, | |
| 11 | * or (at your option) any later version. | |
| 12 | * | |
| 13 | * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | |
| 14 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 15 | * See the GNU Lesser General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU Lesser General Public License along with this library; if not, | |
| 18 | * you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software | |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 20 | * | |
| 21 | * Description: | |
| 22 | * Frame that is not currently suported by this application | |
| 23 | * | |
| 24 | * | |
| 25 | */ | |
| 26 | package org.jaudiotagger.tag.id3.framebody; | |
| 27 | ||
| 28 | import org.jaudiotagger.tag.InvalidTagException; | |
| 29 | import org.jaudiotagger.tag.datatype.ByteArraySizeTerminated; | |
| 30 | import org.jaudiotagger.tag.datatype.DataTypes; | |
| 31 | ||
| 32 | import java.nio.ByteBuffer; | |
| 33 | ||
| 34 | /** | |
| 35 | * Represents a framebody for a frame identifier jaudiotagger has not implemented a framebody for. | |
| 36 | * <p/> | |
| 37 | * This is likley to be because the FrameBody is not specified in the Specification but it may just be because the code | |
| 38 | * has yet to be written, the library uses this framebody when it cant find an alternative. This is different to the | |
| 39 | * ID3v2ExtensionFrameBody Interface which should be implemented by frame bodies that are non standard such as | |
| 40 | * iTunes compilation frame (TCMP) but are commonly used. | |
| 41 | */ | |
| 42 | public class FrameBodyUnsupported extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody, ID3v22FrameBody | |
| 43 | { | |
| 44 | /** | |
| 45 | * Because used by any unknown frame identifier varies | |
| 46 | */ | |
| 47 | 34 | private String identifier = ""; |
| 48 | ||
| 49 | /** | |
| 50 | * @deprecated because no identifier set | |
| 51 | */ | |
| 52 | public FrameBodyUnsupported() | |
| 53 | 0 | { |
| 54 | ||
| 55 | 0 | } |
| 56 | ||
| 57 | /** | |
| 58 | * Creates a new FrameBodyUnsupported | |
| 59 | */ | |
| 60 | public FrameBodyUnsupported(String identifier) | |
| 61 | 0 | { |
| 62 | 0 | this.identifier = identifier; |
| 63 | 0 | } |
| 64 | ||
| 65 | /** | |
| 66 | * Create a new FrameBodyUnsupported | |
| 67 | * | |
| 68 | * @param identifier | |
| 69 | * @param value | |
| 70 | */ | |
| 71 | public FrameBodyUnsupported(String identifier, byte[] value) | |
| 72 | 4 | { |
| 73 | 4 | this.identifier = identifier; |
| 74 | 4 | setObjectValue(DataTypes.OBJ_DATA, value); |
| 75 | 4 | } |
| 76 | ||
| 77 | /** | |
| 78 | * Creates a new FrameBodyUnsupported datatype. | |
| 79 | * | |
| 80 | * @param value | |
| 81 | * @deprecated because no identifier set | |
| 82 | */ | |
| 83 | public FrameBodyUnsupported(byte[] value) | |
| 84 | 0 | { |
| 85 | 0 | setObjectValue(DataTypes.OBJ_DATA, value); |
| 86 | 0 | } |
| 87 | ||
| 88 | /** | |
| 89 | * Copy constructor | |
| 90 | * | |
| 91 | * @param copyObject a copy is made of this | |
| 92 | */ | |
| 93 | public FrameBodyUnsupported(FrameBodyUnsupported copyObject) | |
| 94 | { | |
| 95 | 17 | super(copyObject); |
| 96 | 17 | this.identifier = new String(copyObject.identifier); |
| 97 | ||
| 98 | 17 | } |
| 99 | ||
| 100 | /** | |
| 101 | * Creates a new FrameBodyUnsupported datatype. | |
| 102 | * | |
| 103 | * @throws InvalidFrameException if unable to create framebody from buffer | |
| 104 | */ | |
| 105 | public FrameBodyUnsupported(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException | |
| 106 | { | |
| 107 | 13 | super(byteBuffer, frameSize); |
| 108 | 13 | } |
| 109 | ||
| 110 | /** | |
| 111 | * Return the frame identifier | |
| 112 | * | |
| 113 | * @return the identifier | |
| 114 | */ | |
| 115 | public String getIdentifier() | |
| 116 | { | |
| 117 | 48 | return identifier; |
| 118 | } | |
| 119 | ||
| 120 | /** | |
| 121 | * @param obj | |
| 122 | * @return whether obj is equivalent to this object | |
| 123 | */ | |
| 124 | public boolean equals(Object obj) | |
| 125 | { | |
| 126 | 0 | if ((obj instanceof FrameBodyUnsupported) == false) |
| 127 | { | |
| 128 | 0 | return false; |
| 129 | } | |
| 130 | ||
| 131 | 0 | FrameBodyUnsupported object = (FrameBodyUnsupported) obj; |
| 132 | 0 | if (this.identifier.equals(object.identifier) == false) |
| 133 | { | |
| 134 | 0 | return false; |
| 135 | } | |
| 136 | 0 | return super.equals(obj); |
| 137 | } | |
| 138 | ||
| 139 | ||
| 140 | /** | |
| 141 | * Because the contents of this frame are an array of bytes and could be large we just | |
| 142 | * return the identifier. | |
| 143 | * | |
| 144 | * @return a string representation of this frame | |
| 145 | */ | |
| 146 | public String toString() | |
| 147 | { | |
| 148 | 0 | return getIdentifier(); |
| 149 | } | |
| 150 | ||
| 151 | /** | |
| 152 | * Setup the Object List. A byte Array which will be read upto frame size | |
| 153 | * bytes. | |
| 154 | */ | |
| 155 | protected void setupObjectList() | |
| 156 | { | |
| 157 | 17 | objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_DATA, this)); |
| 158 | 17 | } |
| 159 | ||
| 160 | } |