Coverage Report - org.jaudiotagger.tag.id3.framebody.FrameBodyUnsupported
 
Classes in this File Line Coverage Branch Coverage Complexity
FrameBodyUnsupported
61%
16/26
0%
0/6
1.3
 
 1  
 /**
 2  
  *  @author : Paul Taylor
 3  
  *  @author : Eric Farng
 4  
  *
 5  
  *  Version @version:$Id: FrameBodyUnsupported.java 836 2009-11-12 15:44:07Z paultaylor $
 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  124
     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  
      * @param identifier
 60  
      */
 61  
     public FrameBodyUnsupported(String identifier)
 62  20
     {
 63  20
         this.identifier = identifier;
 64  20
     }
 65  
 
 66  
     /**
 67  
      * Create a new FrameBodyUnsupported
 68  
      *
 69  
      * @param identifier
 70  
      * @param value
 71  
      */
 72  
     public FrameBodyUnsupported(String identifier, byte[] value)
 73  4
     {
 74  4
         this.identifier = identifier;
 75  4
         setObjectValue(DataTypes.OBJ_DATA, value);
 76  4
     }
 77  
 
 78  
     /**
 79  
      * Creates a new FrameBodyUnsupported datatype.
 80  
      *
 81  
      * @param value
 82  
      * @deprecated because no identifier set
 83  
      */
 84  
     public FrameBodyUnsupported(byte[] value)
 85  0
     {
 86  0
         setObjectValue(DataTypes.OBJ_DATA, value);
 87  0
     }
 88  
 
 89  
     /**
 90  
      * Copy constructor
 91  
      *
 92  
      * @param copyObject a copy is made of this
 93  
      */
 94  
     public FrameBodyUnsupported(FrameBodyUnsupported copyObject)
 95  
     {
 96  62
         super(copyObject);
 97  62
         this.identifier = copyObject.identifier;
 98  
 
 99  62
     }
 100  
 
 101  
     /**
 102  
      * Creates a new FrameBodyUnsupported datatype.
 103  
      *
 104  
      * @param byteBuffer
 105  
      * @param frameSize
 106  
      * @throws InvalidFrameException if unable to create framebody from buffer
 107  
      * @throws org.jaudiotagger.tag.InvalidTagException
 108  
      */
 109  
     public FrameBodyUnsupported(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException
 110  
     {
 111  38
         super(byteBuffer, frameSize);
 112  38
     }
 113  
 
 114  
     /**
 115  
      * Return the frame identifier
 116  
      *
 117  
      * @return the identifier
 118  
      */
 119  
     public String getIdentifier()
 120  
     {
 121  126
         return identifier;
 122  
     }
 123  
 
 124  
     /**
 125  
      * @param obj
 126  
      * @return whether obj is equivalent to this object
 127  
      */
 128  
     public boolean equals(Object obj)
 129  
     {
 130  0
         if (!(obj instanceof FrameBodyUnsupported))
 131  
         {
 132  0
             return false;
 133  
         }
 134  
 
 135  0
         FrameBodyUnsupported object = (FrameBodyUnsupported) obj;
 136  0
         return this.identifier.equals(object.identifier) && 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  62
         objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_DATA, this));
 158  62
     }
 159  
 
 160  
 }