| 1 | |
package org.jaudiotagger.audio.asf.data; |
| 2 | |
|
| 3 | |
import org.jaudiotagger.audio.asf.util.Utils; |
| 4 | |
|
| 5 | |
import java.math.BigInteger; |
| 6 | |
import java.util.ArrayList; |
| 7 | |
import java.util.Collection; |
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
public class EncryptionChunk extends Chunk { |
| 13 | |
private String keyID; |
| 14 | |
|
| 15 | |
private String licenseURL; |
| 16 | |
private String protectionType; |
| 17 | |
private String secretData; |
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
private final ArrayList<String> strings; |
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
public EncryptionChunk(final BigInteger chunkLen) { |
| 30 | 0 | super(GUID.GUID_CONTENT_ENCRYPTION, chunkLen); |
| 31 | 0 | this.strings = new ArrayList<String>(); |
| 32 | 0 | this.secretData = ""; |
| 33 | 0 | this.protectionType = ""; |
| 34 | 0 | this.keyID = ""; |
| 35 | 0 | this.licenseURL = ""; |
| 36 | 0 | } |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
public void addString(final String toAdd) { |
| 45 | 0 | this.strings.add(toAdd); |
| 46 | 0 | } |
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
public String getKeyID() { |
| 53 | 0 | return this.keyID; |
| 54 | |
} |
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
public String getLicenseURL() { |
| 61 | 0 | return this.licenseURL; |
| 62 | |
} |
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
public String getProtectionType() { |
| 69 | 0 | return this.protectionType; |
| 70 | |
} |
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
public String getSecretData() { |
| 77 | 0 | return this.secretData; |
| 78 | |
} |
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
|
| 86 | |
public Collection<String> getStrings() { |
| 87 | 0 | return new ArrayList<String>(this.strings); |
| 88 | |
} |
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
@Override |
| 94 | |
public String prettyPrint(final String prefix) { |
| 95 | 0 | final StringBuilder result = new StringBuilder(super.prettyPrint(prefix)); |
| 96 | 0 | result.insert(0, Utils.LINE_SEPARATOR + prefix + " Encryption:" |
| 97 | |
+ Utils.LINE_SEPARATOR); |
| 98 | 0 | result.append(prefix).append(" |->keyID ").append(this.keyID).append( |
| 99 | |
Utils.LINE_SEPARATOR); |
| 100 | 0 | result.append(prefix).append(" |->secretData ").append(this.secretData) |
| 101 | |
.append(Utils.LINE_SEPARATOR); |
| 102 | 0 | result.append(prefix).append(" |->protectionType ").append( |
| 103 | |
this.protectionType).append(Utils.LINE_SEPARATOR); |
| 104 | 0 | result.append(prefix).append(" |->licenseURL ").append(this.licenseURL) |
| 105 | |
.append(Utils.LINE_SEPARATOR); |
| 106 | 0 | this.strings.iterator(); |
| 107 | 0 | for (final String string : this.strings) { |
| 108 | 0 | result.append(prefix).append(" |->").append(string).append(Utils.LINE_SEPARATOR); |
| 109 | |
} |
| 110 | 0 | return result.toString(); |
| 111 | |
} |
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
public void setKeyID(final String toAdd) { |
| 120 | 0 | this.keyID = toAdd; |
| 121 | 0 | } |
| 122 | |
|
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
public void setLicenseURL(final String toAdd) { |
| 130 | 0 | this.licenseURL = toAdd; |
| 131 | 0 | } |
| 132 | |
|
| 133 | |
|
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 138 | |
|
| 139 | |
public void setProtectionType(final String toAdd) { |
| 140 | 0 | this.protectionType = toAdd; |
| 141 | 0 | } |
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
|
| 147 | |
|
| 148 | |
|
| 149 | |
public void setSecretData(final String toAdd) { |
| 150 | 0 | this.secretData = toAdd; |
| 151 | 0 | } |
| 152 | |
} |