| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FrameBodyDeprecated |
|
| 1.6666666666666667;1.667 |
| 1 | package org.jaudiotagger.tag.id3.framebody; | |
| 2 | ||
| 3 | /** | |
| 4 | * Represents a framebody for a frame identifier that is not defined for the tag version but was valid for a for an | |
| 5 | * earlier tag version. | |
| 6 | * The body consists of an array of bytes representing all the bytes in the body. | |
| 7 | */ | |
| 8 | public class FrameBodyDeprecated extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody | |
| 9 | { | |
| 10 | /* The original framebody is held so can be retrieved | |
| 11 | * when converting a DeprecatedFrameBody back to a normal Framebody */ | |
| 12 | private AbstractID3v2FrameBody originalFrameBody; | |
| 13 | ||
| 14 | ||
| 15 | /** | |
| 16 | * Creates a new FrameBodyDeprecated wrapper around the frameBody | |
| 17 | */ | |
| 18 | public FrameBodyDeprecated(AbstractID3v2FrameBody frameBody) | |
| 19 | 8 | { |
| 20 | 8 | this.originalFrameBody = frameBody; |
| 21 | 8 | } |
| 22 | ||
| 23 | /** | |
| 24 | * Copy constructor | |
| 25 | * | |
| 26 | * @param copyObject a copy is made of this | |
| 27 | */ | |
| 28 | public FrameBodyDeprecated(FrameBodyDeprecated copyObject) | |
| 29 | { | |
| 30 | 0 | super(copyObject); |
| 31 | 0 | } |
| 32 | ||
| 33 | ||
| 34 | /** | |
| 35 | * Return the frame identifier | |
| 36 | * | |
| 37 | * @return the identifier | |
| 38 | */ | |
| 39 | public String getIdentifier() | |
| 40 | { | |
| 41 | 1 | return originalFrameBody.getIdentifier(); |
| 42 | } | |
| 43 | ||
| 44 | /** | |
| 45 | * Delgate size to size of original framebody, if framebody already exist will take this value from the frame header | |
| 46 | * but it is always recalculated before writing any changes back to disk. | |
| 47 | * | |
| 48 | * @return size in bytes of this frame body | |
| 49 | */ | |
| 50 | public int getSize() | |
| 51 | { | |
| 52 | 0 | return originalFrameBody.getSize(); |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * @param obj | |
| 57 | * @return whether obj is equivalent to this object | |
| 58 | */ | |
| 59 | public boolean equals(Object obj) | |
| 60 | { | |
| 61 | 0 | if ((obj instanceof FrameBodyDeprecated) == false) |
| 62 | { | |
| 63 | 0 | return false; |
| 64 | } | |
| 65 | ||
| 66 | 0 | FrameBodyDeprecated object = (FrameBodyDeprecated) obj; |
| 67 | 0 | if (this.getIdentifier().equals(object.getIdentifier()) == false) |
| 68 | { | |
| 69 | 0 | return false; |
| 70 | } | |
| 71 | 0 | return super.equals(obj); |
| 72 | } | |
| 73 | ||
| 74 | /** | |
| 75 | * Return the original framebody that was used to construct the DeprecatedFrameBody | |
| 76 | * | |
| 77 | * @return the original frameBody | |
| 78 | */ | |
| 79 | public AbstractID3v2FrameBody getOriginalFrameBody() | |
| 80 | { | |
| 81 | 6 | return originalFrameBody; |
| 82 | } | |
| 83 | ||
| 84 | /** | |
| 85 | * Because the contents of this frame are an array of bytes and could be large we just | |
| 86 | * return the identifier. | |
| 87 | * | |
| 88 | * @return a string representation of this frame | |
| 89 | */ | |
| 90 | public String toString() | |
| 91 | { | |
| 92 | 0 | return getIdentifier(); |
| 93 | } | |
| 94 | ||
| 95 | /** | |
| 96 | * Setup the Object List. | |
| 97 | * <p/> | |
| 98 | * This is handled by the wrapped class | |
| 99 | */ | |
| 100 | protected void setupObjectList() | |
| 101 | { | |
| 102 | ||
| 103 | 8 | } |
| 104 | ||
| 105 | public String getBriefDescription() | |
| 106 | { | |
| 107 | //TODO When is this null, it seems it can be but Im not sure why | |
| 108 | 1 | if (originalFrameBody != null) |
| 109 | { | |
| 110 | 1 | return originalFrameBody.getBriefDescription(); |
| 111 | } | |
| 112 | 0 | return ""; |
| 113 | } | |
| 114 | } |