| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FrameBodyDeprecated |
|
| 1.5555555555555556;1.556 |
| 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 | * @param frameBody | |
| 18 | */ | |
| 19 | public FrameBodyDeprecated(AbstractID3v2FrameBody frameBody) | |
| 20 | 32 | { |
| 21 | 32 | this.originalFrameBody = frameBody; |
| 22 | 32 | } |
| 23 | ||
| 24 | /** | |
| 25 | * Copy constructor | |
| 26 | * | |
| 27 | * @param copyObject a copy is made of this | |
| 28 | */ | |
| 29 | public FrameBodyDeprecated(FrameBodyDeprecated copyObject) | |
| 30 | { | |
| 31 | 0 | super(copyObject); |
| 32 | 0 | } |
| 33 | ||
| 34 | ||
| 35 | /** | |
| 36 | * Return the frame identifier | |
| 37 | * | |
| 38 | * @return the identifier | |
| 39 | */ | |
| 40 | public String getIdentifier() | |
| 41 | { | |
| 42 | 4 | return originalFrameBody.getIdentifier(); |
| 43 | } | |
| 44 | ||
| 45 | /** | |
| 46 | * Delgate size to size of original framebody, if framebody already exist will take this value from the frame header | |
| 47 | * but it is always recalculated before writing any changes back to disk. | |
| 48 | * | |
| 49 | * @return size in bytes of this frame body | |
| 50 | */ | |
| 51 | public int getSize() | |
| 52 | { | |
| 53 | 0 | return originalFrameBody.getSize(); |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 | * @param obj | |
| 58 | * @return whether obj is equivalent to this object | |
| 59 | */ | |
| 60 | public boolean equals(Object obj) | |
| 61 | { | |
| 62 | 0 | if (!(obj instanceof FrameBodyDeprecated)) |
| 63 | { | |
| 64 | 0 | return false; |
| 65 | } | |
| 66 | ||
| 67 | 0 | FrameBodyDeprecated object = (FrameBodyDeprecated) obj; |
| 68 | 0 | return this.getIdentifier().equals(object.getIdentifier()) && super.equals(obj); |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * Return the original framebody that was used to construct the DeprecatedFrameBody | |
| 73 | * | |
| 74 | * @return the original frameBody | |
| 75 | */ | |
| 76 | public AbstractID3v2FrameBody getOriginalFrameBody() | |
| 77 | { | |
| 78 | 24 | return originalFrameBody; |
| 79 | } | |
| 80 | ||
| 81 | /** | |
| 82 | * Because the contents of this frame are an array of bytes and could be large we just | |
| 83 | * return the identifier. | |
| 84 | * | |
| 85 | * @return a string representation of this frame | |
| 86 | */ | |
| 87 | public String toString() | |
| 88 | { | |
| 89 | 0 | return getIdentifier(); |
| 90 | } | |
| 91 | ||
| 92 | /** | |
| 93 | * Setup the Object List. | |
| 94 | * <p/> | |
| 95 | * This is handled by the wrapped class | |
| 96 | */ | |
| 97 | protected void setupObjectList() | |
| 98 | { | |
| 99 | ||
| 100 | 32 | } |
| 101 | ||
| 102 | public String getBriefDescription() | |
| 103 | { | |
| 104 | //TODO When is this null, it seems it can be but Im not sure why | |
| 105 | 4 | if (originalFrameBody != null) |
| 106 | { | |
| 107 | 4 | return originalFrameBody.getBriefDescription(); |
| 108 | } | |
| 109 | 0 | return ""; |
| 110 | } | |
| 111 | } |