2
* MusicTag Copyright (C)2003,2004
4
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
5
* General Public License as published by the Free Software Foundation; either version 2.1 of the License,
6
* or (at your option) any later version.
8
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
* See the GNU Lesser General Public License for more details.
12
* You should have received a copy of the GNU Lesser General Public License along with this library; if not,
13
* you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
package org.jaudiotagger.tag.id3.framebody;
18
import org.jaudiotagger.tag.InvalidTagException;
19
import org.jaudiotagger.tag.datatype.*;
20
import org.jaudiotagger.tag.id3.ID3v24Frames;
22
import java.nio.ByteBuffer;
25
* Encryption method registration frame.
28
* To identify with which method a frame has been encrypted the
29
* encryption method must be registered in the tag with this frame. The
30
* 'Owner identifier' is a null-terminated string with a URL
31
* containing an email address, or a link to a location where an email
32
* address can be found, that belongs to the organisation responsible
33
* for this specific encryption method. Questions regarding the
34
* encryption method should be sent to the indicated email address. The
35
* 'Method symbol' contains a value that is associated with this method
36
* throughout the whole tag. Values below $80 are reserved. The 'Method
37
* symbol' may optionally be followed by encryption specific data. There
38
* may be several "ENCR" frames in a tag but only one containing the
39
* same symbol and only one containing the same owner identifier. The
40
* method must be used somewhere in the tag. See section 3.3.1, flag j
41
* for more information.
42
* </p><p><table border=0 width="70%">
43
* <tr><td colspan=2><Header for 'Encryption method registration', ID: "ENCR"></td></tr>
44
* <tr><td>Owner identifier</td><td width="80%"><text string> $00</td></tr>
45
* <tr><td>Method symbol </td><td>$xx </td></tr>
46
* <tr><td>Encryption data </td><td><binary data> </td></tr>
49
* <p>For more details, please refer to the ID3 specifications:
51
* <li><a href="http://www.id3.org/id3v2.3.0.txt">ID3 v2.3.0 Spec</a>
54
* @author : Paul Taylor
55
* @author : Eric Farng
56
* @version $Id: FrameBodyENCR.java,v 1.12 2007/08/06 16:04:34 paultaylor Exp $
58
public class FrameBodyENCR extends AbstractID3v2FrameBody implements ID3v24FrameBody,ID3v23FrameBody
61
* Creates a new FrameBodyENCR datatype.
63
public FrameBodyENCR()
65
this.setObjectValue(DataTypes.OBJ_OWNER, "");
66
this.setObjectValue(DataTypes.OBJ_METHOD_SYMBOL, (byte) 0);
67
this.setObjectValue(DataTypes.OBJ_METHOD_SYMBOL, new byte[0]);
70
public FrameBodyENCR(FrameBodyENCR body)
76
* Creates a new FrameBodyENCR datatype.
82
public FrameBodyENCR(String owner, byte methodSymbol, byte[] data)
84
this.setObjectValue(DataTypes.OBJ_OWNER, owner);
85
this.setObjectValue(DataTypes.OBJ_METHOD_SYMBOL, methodSymbol);
86
this.setObjectValue(DataTypes.OBJ_METHOD_SYMBOL, data);
90
* Creates a new FrameBodyENCR datatype.
92
* @throws InvalidTagException if unable to create framebody from buffer
94
public FrameBodyENCR(ByteBuffer byteBuffer, int frameSize)
95
throws InvalidTagException
97
super(byteBuffer, frameSize);
101
* The ID3v2 frame identifier
103
* @return the ID3v2 frame identifier for this frame type
105
public String getIdentifier()
107
return ID3v24Frames.FRAME_ID_ENCRYPTION;
115
public void setOwner(String owner)
117
setObjectValue(DataTypes.OBJ_OWNER, owner);
125
public String getOwner()
127
return (String) getObjectValue(DataTypes.OBJ_OWNER);
133
protected void setupObjectList()
135
objectList.add(new StringNullTerminated(DataTypes.OBJ_OWNER, this));
136
objectList.add(new NumberFixedLength(DataTypes.OBJ_METHOD_SYMBOL, this, 1));
137
objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_ENCRYPTION_INFO, this));