Coverage Report - org.jaudiotagger.audio.asf.data.EncryptionChunk
 
Classes in this File Line Coverage Branch Coverage Complexity
EncryptionChunk
0%
0/32
0%
0/2
0
 
 1  
 package org.jaudiotagger.audio.asf.data;
 2  
 
 3  
 import java.math.BigInteger;
 4  
 import java.util.ArrayList;
 5  
 import java.util.Collection;
 6  
 import java.util.Iterator;
 7  
 
 8  
 import org.jaudiotagger.audio.asf.util.Utils;
 9  
 
 10  
 
 11  
 /**
 12  
  * @author eric
 13  
  */
 14  
 public class EncryptionChunk extends Chunk
 15  
 {
 16  
     /**
 17  
      * The read strings.
 18  
      */
 19  
     private final ArrayList<String> strings;
 20  
 
 21  
     private String secretData;
 22  
     private String protectionType;
 23  
     private String keyID;
 24  
     private String licenseURL;
 25  
 
 26  
     /**
 27  
      * Creates an instance.
 28  
      *
 29  
      * @param chunkLen Length of current chunk.
 30  
      */
 31  
     public EncryptionChunk(BigInteger chunkLen)
 32  
     {
 33  0
         super(GUID.GUID_CONTENT_ENCRYPTION, chunkLen);
 34  0
         this.strings = new ArrayList<String>();
 35  0
         this.secretData = "";
 36  0
         this.protectionType = "";
 37  0
         this.keyID = "";
 38  0
         this.licenseURL = "";
 39  0
     }
 40  
 
 41  
     /**
 42  
      * This method adds the secret data.
 43  
      *
 44  
      * @param toAdd String to add.
 45  
      */
 46  
     public void setSecretData(String toAdd)
 47  
     {
 48  0
         secretData = toAdd;
 49  0
     }
 50  
 
 51  
     /**
 52  
      * This method gets the secret data.
 53  
      */
 54  
     public String getSecretData()
 55  
     {
 56  0
         return secretData;
 57  
     }
 58  
 
 59  
     /**
 60  
      * This method appends a String.
 61  
      *
 62  
      * @param toAdd String to add.
 63  
      */
 64  
     public void setProtectionType(String toAdd)
 65  
     {
 66  0
         protectionType = toAdd;
 67  0
     }
 68  
 
 69  
     /**
 70  
      * This method gets the secret data.
 71  
      */
 72  
     public String getProtectionType()
 73  
     {
 74  0
         return protectionType;
 75  
     }
 76  
 
 77  
     /**
 78  
      * This method appends a String.
 79  
      *
 80  
      * @param toAdd String to add.
 81  
      */
 82  
     public void setKeyID(String toAdd)
 83  
     {
 84  0
         keyID = toAdd;
 85  0
     }
 86  
 
 87  
     /**
 88  
      * This method gets the keyID.
 89  
      */
 90  
     public String getKeyID()
 91  
     {
 92  0
         return keyID;
 93  
     }
 94  
 
 95  
 
 96  
     /**
 97  
      * This method appends a String.
 98  
      *
 99  
      * @param toAdd String to add.
 100  
      */
 101  
     public void setLicenseURL(String toAdd)
 102  
     {
 103  0
         licenseURL = toAdd;
 104  0
     }
 105  
 
 106  
     /**
 107  
      * This method gets the license URL.
 108  
      */
 109  
     public String getLicenseURL()
 110  
     {
 111  0
         return licenseURL;
 112  
     }
 113  
 
 114  
 
 115  
     /**
 116  
      * This method appends a String.
 117  
      *
 118  
      * @param toAdd String to add.
 119  
      */
 120  
     public void addString(String toAdd)
 121  
     {
 122  0
         strings.add(toAdd);
 123  0
     }
 124  
 
 125  
     /**
 126  
      * This method returns a collection of all {@link String}s which were addid
 127  
      * due {@link #addString(String)}.
 128  
      *
 129  
      * @return Inserted Strings.
 130  
      */
 131  
     public Collection<String> getStrings()
 132  
     {
 133  0
         return new ArrayList<String>(strings);
 134  
     }
 135  
 
 136  
     /**
 137  
      * {@inheritDoc}
 138  
      */
 139  
     @Override
 140  
     public String prettyPrint(final String prefix)
 141  
     {
 142  0
         StringBuffer result = new StringBuffer(super.prettyPrint(prefix));
 143  0
         result.insert(0, Utils.LINE_SEPARATOR + prefix + " Encryption:"
 144  
                 + Utils.LINE_SEPARATOR);
 145  0
         result.append(prefix + "        |->keyID " + this.keyID + Utils.LINE_SEPARATOR);
 146  0
         result.append(prefix + "        |->secretData " + this.secretData + Utils.LINE_SEPARATOR);
 147  0
         result.append(prefix + "        |->protectionType " + this.protectionType + Utils.LINE_SEPARATOR);
 148  0
         result.append(prefix + "        |->licenseURL " + this.licenseURL + Utils.LINE_SEPARATOR);
 149  0
         Iterator<String> iterator = this.strings.iterator();
 150  0
         while (iterator.hasNext()) {
 151  0
                         result.append(prefix + "   |->" + iterator.next() + Utils.LINE_SEPARATOR);
 152  
                 }
 153  0
                 return result.toString();
 154  
         }
 155  
 }