package org.farng.mp3.id3; import java.io.IOException; import java.io.RandomAccessFile; import org.farng.mp3.InvalidTagException; import org.farng.mp3.object.ObjectByteArraySizeTerminated; import org.farng.mp3.object.ObjectNumberFixedLength; import org.farng.mp3.object.ObjectStringNullTerminated; /** * <h3>4.25.   Encryption method registration</h3> * <p/> * <p>   To identify with which method a frame has been encrypted the<br> * <p/> *    encryption method must be registered in the tag with this frame. The<br>    'Owner identifier' * is a null-terminated string with a URL [URL]<br>    containing an email address, or a link to a location * where an email<br>    address can be found, that belongs to the organisation responsible<br>    * for this specific encryption method. Questions regarding the<br> * <p/> *    encryption method should be sent to the indicated email address. The<br>    'Method symbol' * contains a value that is associated with this method<br>    throughout the whole tag, in the range $80-F0. * All other values are<br>    reserved. The 'Method symbol' may optionally be followed by<br>    * encryption specific data. There may be several "ENCR" * <p/> * frames in a tag<br>    but only one containing the same symbol and only one containing the<br>    * same owner identifier. The method must be used somewhere in the tag.<br>    See the description of the * frame encryption flag in the ID3v2<br>    structure document [ID3v2-strct] for more information.</p> * <p/> * <p>     <Header for 'Encryption method registration', ID: "ENCR"><br> *      Owner identifier    <text string> $00<br>      * Method symbol       $xx<br> * <p/> *      Encryption data     <binary data><br> </p> * * @author Eric Farng * @version $Revision: 2374 $ */ public class FrameBodyENCR extends AbstractID3v2FrameBody { /** * Creates a new FrameBodyENCR object. */ public FrameBodyENCR() { super(); } /** * Creates a new FrameBodyENCR object. */ public FrameBodyENCR(final FrameBodyENCR body) { super(body); } /** * Creates a new FrameBodyENCR object. */ public FrameBodyENCR(final String owner, final byte methodSymbol, final byte[] data) { setObject("Owner", owner); setObject("Method Symbol", new Byte(methodSymbol)); setObject("Encryption Data", data); } /** * Creates a new FrameBodyENCR object. */ public FrameBodyENCR(final RandomAccessFile file) throws IOException, InvalidTagException { this.read(file); } public String getIdentifier() { return "ENCR" + ((char) 0) + getOwner(); } public void setOwner(final String owner) { setObject("Owner", owner); } public String getOwner() { return (String) getObject("Owner"); } protected void setupObjectList() { appendToObjectList(new ObjectStringNullTerminated("Owner")); appendToObjectList(new ObjectNumberFixedLength("Method Symbol", 1)); appendToObjectList(new ObjectByteArraySizeTerminated("Encryption Data")); } }