Coverage Report - org.jaudiotagger.tag.lyrics3.FieldFrameBodyUnsupported
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldFrameBodyUnsupported
0%
0/46
0%
0/12
1.909
 
 1  
 /**
 2  
  *  @author : Paul Taylor
 3  
  *  @author : Eric Farng
 4  
  *
 5  
  *  Version @version:$Id: FieldFrameBodyUnsupported.java,v 1.11 2008/07/21 10:45:49 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  
  */
 23  
 package org.jaudiotagger.tag.lyrics3;
 24  
 
 25  
 import org.jaudiotagger.tag.InvalidTagException;
 26  
 
 27  
 import java.io.IOException;
 28  
 import java.io.RandomAccessFile;
 29  
 import java.nio.ByteBuffer;
 30  
 
 31  
 
 32  
 public class FieldFrameBodyUnsupported extends AbstractLyrics3v2FieldFrameBody
 33  
 {
 34  
     /**
 35  
      *
 36  
      */
 37  0
     private byte[] value = null;
 38  
 
 39  
     /**
 40  
      * Creates a new FieldBodyUnsupported datatype.
 41  
      */
 42  
     public FieldFrameBodyUnsupported()
 43  0
     {
 44  
         //        this.value = new byte[0];
 45  0
     }
 46  
 
 47  
     public FieldFrameBodyUnsupported(FieldFrameBodyUnsupported copyObject)
 48  
     {
 49  0
         super(copyObject);
 50  0
         this.value = copyObject.value.clone();
 51  0
     }
 52  
 
 53  
     /**
 54  
      * Creates a new FieldBodyUnsupported datatype.
 55  
      *
 56  
      * @param value
 57  
      */
 58  
     public FieldFrameBodyUnsupported(byte[] value)
 59  0
     {
 60  0
         this.value = value;
 61  0
     }
 62  
 
 63  
     /**
 64  
      * Creates a new FieldBodyUnsupported datatype.
 65  
      */
 66  
     public FieldFrameBodyUnsupported(ByteBuffer byteBuffer) throws InvalidTagException
 67  0
     {
 68  
 
 69  0
         this.read(byteBuffer);
 70  
 
 71  0
     }
 72  
 
 73  
     /**
 74  
      * @return
 75  
      */
 76  
     public String getIdentifier()
 77  
     {
 78  0
         return "ZZZ";
 79  
     }
 80  
 
 81  
     /**
 82  
      * @param obj
 83  
      * @return
 84  
      */
 85  
     public boolean isSubsetOf(Object obj)
 86  
     {
 87  0
         if ((obj instanceof FieldFrameBodyUnsupported) == false)
 88  
         {
 89  0
             return false;
 90  
         }
 91  
 
 92  0
         FieldFrameBodyUnsupported object = (FieldFrameBodyUnsupported) obj;
 93  
 
 94  0
         String subset = new String(this.value);
 95  0
         String superset = new String(object.value);
 96  
 
 97  0
         if (!superset.contains(subset))
 98  
         {
 99  0
             return false;
 100  
         }
 101  
 
 102  0
         return super.isSubsetOf(obj);
 103  
     }
 104  
 
 105  
     /**
 106  
      * @param obj
 107  
      * @return
 108  
      */
 109  
     public boolean equals(Object obj)
 110  
     {
 111  0
         if ((obj instanceof FieldFrameBodyUnsupported) == false)
 112  
         {
 113  0
             return false;
 114  
         }
 115  
 
 116  0
         FieldFrameBodyUnsupported object = (FieldFrameBodyUnsupported) obj;
 117  
 
 118  0
         if (java.util.Arrays.equals(this.value, object.value) == false)
 119  
         {
 120  0
             return false;
 121  
         }
 122  
 
 123  0
         return super.equals(obj);
 124  
     }
 125  
 
 126  
     /**
 127  
      * @param byteBuffer
 128  
      * @throws IOException
 129  
      */
 130  
     public void read(ByteBuffer byteBuffer) throws InvalidTagException
 131  
     {
 132  
         int size;
 133  0
         byte[] buffer = new byte[5];
 134  
 
 135  
         // read the 5 character size
 136  0
         byteBuffer.get(buffer, 0, 5);
 137  0
         size = Integer.parseInt(new String(buffer, 0, 5));
 138  
 
 139  0
         value = new byte[size];
 140  
 
 141  
         // read the SIZE length description
 142  0
         byteBuffer.get(value);
 143  0
     }
 144  
 
 145  
     /**
 146  
      * @return
 147  
      */
 148  
     public String toString()
 149  
     {
 150  0
         return getIdentifier() + " : " + (new String(value));
 151  
     }
 152  
 
 153  
     /**
 154  
      * @param file
 155  
      * @throws IOException
 156  
      */
 157  
     public void write(RandomAccessFile file) throws IOException
 158  
     {
 159  0
         int offset = 0;
 160  
         String str;
 161  0
         byte[] buffer = new byte[5];
 162  
 
 163  0
         str = Integer.toString(value.length);
 164  
 
 165  0
         for (int i = 0; i < (5 - str.length()); i++)
 166  
         {
 167  0
             buffer[i] = (byte) '0';
 168  
         }
 169  
 
 170  0
         offset += (5 - str.length());
 171  
 
 172  0
         for (int i = 0; i < str.length(); i++)
 173  
         {
 174  0
             buffer[i + offset] = (byte) str.charAt(i);
 175  
         }
 176  
 
 177  0
         file.write(buffer);
 178  
 
 179  0
         file.write(value);
 180  0
     }
 181  
 
 182  
     /**
 183  
      * TODO
 184  
      */
 185  
     protected void setupObjectList()
 186  
     {
 187  
 
 188  0
     }
 189  
 }