Coverage Report - org.jaudiotagger.tag.lyrics3.FieldFrameBodyUnsupported
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldFrameBodyUnsupported
0%
0/42
0%
0/16
1.727
 
 1  
 /**
 2  
  *  @author : Paul Taylor
 3  
  *  @author : Eric Farng
 4  
  *
 5  
  *  Version @version:$Id: FieldFrameBodyUnsupported.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  
  */
 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  
      * @param byteBuffer
 66  
      * @throws org.jaudiotagger.tag.InvalidTagException
 67  
      */
 68  
     public FieldFrameBodyUnsupported(ByteBuffer byteBuffer) throws InvalidTagException
 69  0
     {
 70  
 
 71  0
         this.read(byteBuffer);
 72  
 
 73  0
     }
 74  
 
 75  
     /**
 76  
      * @return
 77  
      */
 78  
     public String getIdentifier()
 79  
     {
 80  0
         return "ZZZ";
 81  
     }
 82  
 
 83  
     /**
 84  
      * @param obj
 85  
      * @return
 86  
      */
 87  
     public boolean isSubsetOf(Object obj)
 88  
     {
 89  0
         if (!(obj instanceof FieldFrameBodyUnsupported))
 90  
         {
 91  0
             return false;
 92  
         }
 93  
 
 94  0
         FieldFrameBodyUnsupported object = (FieldFrameBodyUnsupported) obj;
 95  
 
 96  0
         String subset = new String(this.value);
 97  0
         String superset = new String(object.value);
 98  
 
 99  0
         return superset.contains(subset) && super.isSubsetOf(obj);
 100  
 
 101  
     }
 102  
 
 103  
     /**
 104  
      * @param obj
 105  
      * @return
 106  
      */
 107  
     public boolean equals(Object obj)
 108  
     {
 109  0
         if (!(obj instanceof FieldFrameBodyUnsupported))
 110  
         {
 111  0
             return false;
 112  
         }
 113  
 
 114  0
         FieldFrameBodyUnsupported object = (FieldFrameBodyUnsupported) obj;
 115  
 
 116  0
         return java.util.Arrays.equals(this.value, object.value) && super.equals(obj);
 117  
 
 118  
     }
 119  
 
 120  
     /**
 121  
      * @param byteBuffer
 122  
      * @throws IOException
 123  
      */
 124  
     public void read(ByteBuffer byteBuffer) throws InvalidTagException
 125  
     {
 126  
         int size;
 127  0
         byte[] buffer = new byte[5];
 128  
 
 129  
         // read the 5 character size
 130  0
         byteBuffer.get(buffer, 0, 5);
 131  0
         size = Integer.parseInt(new String(buffer, 0, 5));
 132  
 
 133  0
         value = new byte[size];
 134  
 
 135  
         // read the SIZE length description
 136  0
         byteBuffer.get(value);
 137  0
     }
 138  
 
 139  
     /**
 140  
      * @return
 141  
      */
 142  
     public String toString()
 143  
     {
 144  0
         return getIdentifier() + " : " + (new String(value));
 145  
     }
 146  
 
 147  
     /**
 148  
      * @param file
 149  
      * @throws IOException
 150  
      */
 151  
     public void write(RandomAccessFile file) throws IOException
 152  
     {
 153  0
         int offset = 0;
 154  
         String str;
 155  0
         byte[] buffer = new byte[5];
 156  
 
 157  0
         str = Integer.toString(value.length);
 158  
 
 159  0
         for (int i = 0; i < (5 - str.length()); i++)
 160  
         {
 161  0
             buffer[i] = (byte) '0';
 162  
         }
 163  
 
 164  0
         offset += (5 - str.length());
 165  
 
 166  0
         for (int i = 0; i < str.length(); i++)
 167  
         {
 168  0
             buffer[i + offset] = (byte) str.charAt(i);
 169  
         }
 170  
 
 171  0
         file.write(buffer);
 172  
 
 173  0
         file.write(value);
 174  0
     }
 175  
 
 176  
     /**
 177  
      * TODO
 178  
      */
 179  
     protected void setupObjectList()
 180  
     {
 181  
 
 182  0
     }
 183  
 }