Coverage Report - org.jaudiotagger.tag.datatype.BooleanString
 
Classes in this File Line Coverage Branch Coverage Complexity
BooleanString
0%
0/17
0%
0/10
1.429
 
 1  
 /**
 2  
  *  @author : Paul Taylor
 3  
  *  @author : Eric Farng
 4  
  *
 5  
  *  Version @version:$Id: BooleanString.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  
  */
 24  
 package org.jaudiotagger.tag.datatype;
 25  
 
 26  
 import org.jaudiotagger.tag.InvalidDataTypeException;
 27  
 import org.jaudiotagger.tag.id3.AbstractTagFrameBody;
 28  
 
 29  
 public class BooleanString extends AbstractDataType
 30  
 {
 31  
     /**
 32  
      * Creates a new ObjectBooleanString datatype.
 33  
      *
 34  
      * @param identifier
 35  
      * @param frameBody
 36  
      */
 37  
     public BooleanString(String identifier, AbstractTagFrameBody frameBody)
 38  
     {
 39  0
         super(identifier, frameBody);
 40  0
     }
 41  
 
 42  
     public BooleanString(BooleanString object)
 43  
     {
 44  0
         super(object);
 45  0
     }
 46  
 
 47  
     /**
 48  
      * @return
 49  
      */
 50  
     public int getSize()
 51  
     {
 52  0
         return 1;
 53  
     }
 54  
 
 55  
     public boolean equals(Object obj)
 56  
     {
 57  0
         return obj instanceof BooleanString && super.equals(obj);
 58  
 
 59  
     }
 60  
 
 61  
     /**
 62  
      * @param offset
 63  
      * @throws NullPointerException
 64  
      * @throws IndexOutOfBoundsException
 65  
      */
 66  
     public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
 67  
     {
 68  0
         byte b = arr[offset];
 69  0
         value = b != '0';
 70  0
     }
 71  
 
 72  
     /**
 73  
      * @return
 74  
      */
 75  
     public String toString()
 76  
     {
 77  0
         return "" + value;
 78  
     }
 79  
 
 80  
     /**
 81  
      * @return
 82  
      */
 83  
     public byte[] writeByteArray()
 84  
     {
 85  0
         byte[] booleanValue = new byte[1];
 86  0
         if (value == null)
 87  
         {
 88  0
             booleanValue[0] = '0';
 89  
         }
 90  
         else
 91  
         {
 92  0
             if ((Boolean) value)
 93  
             {
 94  0
                 booleanValue[0] = '0';
 95  
             }
 96  
             else
 97  
             {
 98  0
                 booleanValue[0] = '1';
 99  
             }
 100  
         }
 101  0
         return booleanValue;
 102  
     }
 103  
 }