~ubuntu-branches/ubuntu/utopic/libjaudiotagger-java/utopic

« back to all changes in this revision

Viewing changes to org/jaudiotagger/tag/id3/framebody/FrameBodyENCR.java

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath, Damien Raude-Morvan, Varun Hiremath
  • Date: 2009-04-01 19:17:56 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090401191756-bygniim270guy7o1
Tags: 1.0.9-1
[ Damien Raude-Morvan ]
* New upstream release
* debian/watch: Use java.net repository (which contains new releases!)
* debian/control:
  - Build-Depends on default-jdk-builddep
  - Bump Standards-Version to 3.8.1 (no changes needed)
  - Change section to "java"
* debian/rules: use default-java as JAVA_HOME
* debina/orig-tar.{sh|excludes}: strip audio and others binary files from ZIP
* debian/build.xml:
  - compile with "nowarn" to keep build log readable
  - exclude LogFormatter from build (use com.sun classes)
* debian/ant.properties: new source directory is "src" in orig.tar.gz
* Add myself as Uploaders

[ Varun Hiremath ]
* Accept changes made by Damien Raude-Morvan (Closes: #522130)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  MusicTag Copyright (C)2003,2004
3
 
 *
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.
7
 
 *
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.
11
 
 *
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
15
 
 */
16
 
package org.jaudiotagger.tag.id3.framebody;
17
 
 
18
 
import org.jaudiotagger.tag.InvalidTagException;
19
 
import org.jaudiotagger.tag.datatype.*;
20
 
import org.jaudiotagger.tag.id3.ID3v24Frames;
21
 
 
22
 
import java.nio.ByteBuffer;
23
 
 
24
 
/**
25
 
 * Encryption method registration frame.
26
 
 * 
27
 
 * <p>
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>&lt;Header for 'Encryption method registration', ID: "ENCR"&gt;</td></tr>
44
 
 * <tr><td>Owner identifier</td><td width="80%">&lt;text string&gt; $00</td></tr>
45
 
 * <tr><td>Method symbol   </td><td>$xx                           </td></tr>
46
 
 * <tr><td>Encryption data </td><td>&lt;binary data&gt;           </td></tr>
47
 
 * </table></p>
48
 
 * 
49
 
 * <p>For more details, please refer to the ID3 specifications:
50
 
 * <ul>
51
 
 * <li><a href="http://www.id3.org/id3v2.3.0.txt">ID3 v2.3.0 Spec</a>
52
 
 * </ul>
53
 
 * 
54
 
 * @author : Paul Taylor
55
 
 * @author : Eric Farng
56
 
 * @version $Id: FrameBodyENCR.java,v 1.12 2007/08/06 16:04:34 paultaylor Exp $
57
 
 */
58
 
public class FrameBodyENCR extends AbstractID3v2FrameBody implements ID3v24FrameBody,ID3v23FrameBody
59
 
{
60
 
    /**
61
 
     * Creates a new FrameBodyENCR datatype.
62
 
     */
63
 
    public FrameBodyENCR()
64
 
    {
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]);
68
 
    }
69
 
 
70
 
    public FrameBodyENCR(FrameBodyENCR body)
71
 
    {
72
 
        super(body);
73
 
    }
74
 
 
75
 
    /**
76
 
     * Creates a new FrameBodyENCR datatype.
77
 
     *
78
 
     * @param owner        
79
 
     * @param methodSymbol 
80
 
     * @param data         
81
 
     */
82
 
    public FrameBodyENCR(String owner, byte methodSymbol, byte[] data)
83
 
    {
84
 
        this.setObjectValue(DataTypes.OBJ_OWNER, owner);
85
 
        this.setObjectValue(DataTypes.OBJ_METHOD_SYMBOL, methodSymbol);
86
 
        this.setObjectValue(DataTypes.OBJ_METHOD_SYMBOL, data);
87
 
    }
88
 
 
89
 
    /**
90
 
     * Creates a new FrameBodyENCR datatype.
91
 
     *
92
 
     * @throws InvalidTagException if unable to create framebody from buffer
93
 
     */
94
 
    public FrameBodyENCR(ByteBuffer byteBuffer, int frameSize)
95
 
        throws InvalidTagException
96
 
    {
97
 
        super(byteBuffer, frameSize);
98
 
    }
99
 
 
100
 
      /**
101
 
      * The ID3v2 frame identifier
102
 
      *
103
 
      * @return the ID3v2 frame identifier  for this frame type
104
 
     */
105
 
    public String getIdentifier()
106
 
    {
107
 
        return  ID3v24Frames.FRAME_ID_ENCRYPTION;
108
 
    }
109
 
 
110
 
    /**
111
 
     * 
112
 
     *
113
 
     * @param owner 
114
 
     */
115
 
    public void setOwner(String owner)
116
 
    {
117
 
        setObjectValue(DataTypes.OBJ_OWNER, owner);
118
 
    }
119
 
 
120
 
    /**
121
 
     * 
122
 
     *
123
 
     * @return 
124
 
     */
125
 
    public String getOwner()
126
 
    {
127
 
        return (String) getObjectValue(DataTypes.OBJ_OWNER);
128
 
    }
129
 
 
130
 
    /**
131
 
     * 
132
 
     */
133
 
    protected void setupObjectList()
134
 
    {
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));
138
 
    }
139
 
}