| 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 | |
|
| 13 | |
|
| 14 | |
public class EncryptionChunk extends Chunk |
| 15 | |
{ |
| 16 | |
|
| 17 | |
|
| 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 | |
|
| 28 | |
|
| 29 | |
|
| 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 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
public void setSecretData(String toAdd) |
| 47 | |
{ |
| 48 | 0 | secretData = toAdd; |
| 49 | 0 | } |
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
public String getSecretData() |
| 55 | |
{ |
| 56 | 0 | return secretData; |
| 57 | |
} |
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
public void setProtectionType(String toAdd) |
| 65 | |
{ |
| 66 | 0 | protectionType = toAdd; |
| 67 | 0 | } |
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
public String getProtectionType() |
| 73 | |
{ |
| 74 | 0 | return protectionType; |
| 75 | |
} |
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
public void setKeyID(String toAdd) |
| 83 | |
{ |
| 84 | 0 | keyID = toAdd; |
| 85 | 0 | } |
| 86 | |
|
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
public String getKeyID() |
| 91 | |
{ |
| 92 | 0 | return keyID; |
| 93 | |
} |
| 94 | |
|
| 95 | |
|
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
public void setLicenseURL(String toAdd) |
| 102 | |
{ |
| 103 | 0 | licenseURL = toAdd; |
| 104 | 0 | } |
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
public String getLicenseURL() |
| 110 | |
{ |
| 111 | 0 | return licenseURL; |
| 112 | |
} |
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
public void addString(String toAdd) |
| 121 | |
{ |
| 122 | 0 | strings.add(toAdd); |
| 123 | 0 | } |
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | |
public Collection<String> getStrings() |
| 132 | |
{ |
| 133 | 0 | return new ArrayList<String>(strings); |
| 134 | |
} |
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 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 | |
} |