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.DataTypes;
20
import org.jaudiotagger.tag.datatype.StringFixedLength;
21
import org.jaudiotagger.tag.datatype.StringNullTerminated;
22
import org.jaudiotagger.tag.datatype.StringSizeTerminated;
23
import org.jaudiotagger.tag.id3.ID3v24Frames;
25
import java.nio.ByteBuffer;
28
* Linked information frame.
31
* To keep space waste as low as possible this frame may be used to link
32
* information from another ID3v2 tag that might reside in another audio
33
* file or alone in a binary file. It is recommended that this method is
34
* only used when the files are stored on a CD-ROM or other
35
* circumstances when the risk of file seperation is low. The frame
36
* contains a frame identifier, which is the frame that should be linked
37
* into this tag, a URL field, where a reference to the file where
38
* the frame is given, and additional ID data, if needed. Data should be
39
* retrieved from the first tag found in the file to which this link
40
* points. There may be more than one "LINK" frame in a tag, but only
41
* one with the same contents. A linked frame is to be considered as
42
* part of the tag and has the same restrictions as if it was a physical
43
* part of the tag (i.e. only one "RVRB" frame allowed, whether it's
45
* </p><p><table border=0 width="70%">
46
* <tr><td><Header for 'Linked information', ID: "LINK"> </td></tr>
47
* <tr><td>Frame identifier </td><td>$xx xx xx </td></tr>
48
* <tr><td>URL </td><td><text string> $00</td></tr>
49
* <tr><td>ID and additional data</td><td><text string(s)> </td></tr>
52
* Frames that may be linked and need no additional data are "IPLS",
53
* "MCID", "ETCO", "MLLT", "SYTC", "RVAD", "EQUA", "RVRB", "RBUF", the
54
* text information frames and the URL link frames.
56
* The "TXXX", "APIC", "GEOB" and "AENC" frames may be linked with
57
* the content descriptor as additional ID data.
59
* The "COMM", "SYLT" and "USLT" frames may be linked with three bytes
60
* of language descriptor directly followed by a content descriptor as
64
* <p>For more details, please refer to the ID3 specifications:
66
* <li><a href="http://www.id3.org/id3v2.3.0.txt">ID3 v2.3.0 Spec</a>
69
* @author : Paul Taylor
70
* @author : Eric Farng
71
* @version $Id: FrameBodyLINK.java,v 1.14 2009/11/12 13:25:22 paultaylor Exp $
73
public class FrameBodyLINK extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody
76
* Creates a new FrameBodyLINK datatype.
78
public FrameBodyLINK()
80
// this.setObject("Frame Identifier", "");
81
// this.setObject("URL", "");
82
// this.setObject("ID and Additional Data", "");
85
public FrameBodyLINK(FrameBodyLINK body)
91
* Creates a new FrameBodyLINK datatype.
93
* @param frameIdentifier
95
* @param additionalData
97
public FrameBodyLINK(String frameIdentifier, String url, String additionalData)
99
this.setObjectValue(DataTypes.OBJ_DESCRIPTION, frameIdentifier);
100
this.setObjectValue(DataTypes.OBJ_URL, url);
101
this.setObjectValue(DataTypes.OBJ_ID, additionalData);
105
* Creates a new FrameBodyLINK datatype.
109
* @throws InvalidTagException if unable to create framebody from buffer
111
public FrameBodyLINK(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException
113
super(byteBuffer, frameSize);
119
public String getAdditionalData()
121
return (String) getObjectValue(DataTypes.OBJ_ID);
125
* @param additionalData
127
public void getAdditionalData(String additionalData)
129
setObjectValue(DataTypes.OBJ_ID, additionalData);
135
public String getFrameIdentifier()
137
return (String) getObjectValue(DataTypes.OBJ_DESCRIPTION);
141
* @param frameIdentifier
143
public void getFrameIdentifier(String frameIdentifier)
145
setObjectValue(DataTypes.OBJ_DESCRIPTION, frameIdentifier);
149
* The ID3v2 frame identifier
151
* @return the ID3v2 frame identifier for this frame type
153
public String getIdentifier()
155
return ID3v24Frames.FRAME_ID_LINKED_INFO;
162
protected void setupObjectList()
164
objectList.add(new StringFixedLength(DataTypes.OBJ_DESCRIPTION, this, 4));
165
objectList.add(new StringNullTerminated(DataTypes.OBJ_URL, this));
166
objectList.add(new StringSizeTerminated(DataTypes.OBJ_ID, this));
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.DataTypes;
20
import org.jaudiotagger.tag.datatype.StringFixedLength;
21
import org.jaudiotagger.tag.datatype.StringNullTerminated;
22
import org.jaudiotagger.tag.datatype.StringSizeTerminated;
23
import org.jaudiotagger.tag.id3.ID3v24Frames;
25
import java.nio.ByteBuffer;
28
* Linked information frame.
31
* To keep space waste as low as possible this frame may be used to link
32
* information from another ID3v2 tag that might reside in another audio
33
* file or alone in a binary file. It is recommended that this method is
34
* only used when the files are stored on a CD-ROM or other
35
* circumstances when the risk of file seperation is low. The frame
36
* contains a frame identifier, which is the frame that should be linked
37
* into this tag, a URL field, where a reference to the file where
38
* the frame is given, and additional ID data, if needed. Data should be
39
* retrieved from the first tag found in the file to which this link
40
* points. There may be more than one "LINK" frame in a tag, but only
41
* one with the same contents. A linked frame is to be considered as
42
* part of the tag and has the same restrictions as if it was a physical
43
* part of the tag (i.e. only one "RVRB" frame allowed, whether it's
45
* </p><p><table border=0 width="70%">
46
* <tr><td><Header for 'Linked information', ID: "LINK"> </td></tr>
47
* <tr><td>Frame identifier </td><td>$xx xx xx </td></tr>
48
* <tr><td>URL </td><td><text string> $00</td></tr>
49
* <tr><td>ID and additional data</td><td><text string(s)> </td></tr>
52
* Frames that may be linked and need no additional data are "IPLS",
53
* "MCID", "ETCO", "MLLT", "SYTC", "RVAD", "EQUA", "RVRB", "RBUF", the
54
* text information frames and the URL link frames.
56
* The "TXXX", "APIC", "GEOB" and "AENC" frames may be linked with
57
* the content descriptor as additional ID data.
59
* The "COMM", "SYLT" and "USLT" frames may be linked with three bytes
60
* of language descriptor directly followed by a content descriptor as
64
* <p>For more details, please refer to the ID3 specifications:
66
* <li><a href="http://www.id3.org/id3v2.3.0.txt">ID3 v2.3.0 Spec</a>
69
* @author : Paul Taylor
70
* @author : Eric Farng
71
* @version $Id: FrameBodyLINK.java 832 2009-11-12 13:25:38Z paultaylor $
73
public class FrameBodyLINK extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody
76
* Creates a new FrameBodyLINK datatype.
78
public FrameBodyLINK()
80
// this.setObject("Frame Identifier", "");
81
// this.setObject("URL", "");
82
// this.setObject("ID and Additional Data", "");
85
public FrameBodyLINK(FrameBodyLINK body)
91
* Creates a new FrameBodyLINK datatype.
93
* @param frameIdentifier
95
* @param additionalData
97
public FrameBodyLINK(String frameIdentifier, String url, String additionalData)
99
this.setObjectValue(DataTypes.OBJ_DESCRIPTION, frameIdentifier);
100
this.setObjectValue(DataTypes.OBJ_URL, url);
101
this.setObjectValue(DataTypes.OBJ_ID, additionalData);
105
* Creates a new FrameBodyLINK datatype.
109
* @throws InvalidTagException if unable to create framebody from buffer
111
public FrameBodyLINK(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException
113
super(byteBuffer, frameSize);
119
public String getAdditionalData()
121
return (String) getObjectValue(DataTypes.OBJ_ID);
125
* @param additionalData
127
public void getAdditionalData(String additionalData)
129
setObjectValue(DataTypes.OBJ_ID, additionalData);
135
public String getFrameIdentifier()
137
return (String) getObjectValue(DataTypes.OBJ_DESCRIPTION);
141
* @param frameIdentifier
143
public void getFrameIdentifier(String frameIdentifier)
145
setObjectValue(DataTypes.OBJ_DESCRIPTION, frameIdentifier);
149
* The ID3v2 frame identifier
151
* @return the ID3v2 frame identifier for this frame type
153
public String getIdentifier()
155
return ID3v24Frames.FRAME_ID_LINKED_INFO;
162
protected void setupObjectList()
164
objectList.add(new StringFixedLength(DataTypes.OBJ_DESCRIPTION, this, 4));
165
objectList.add(new StringNullTerminated(DataTypes.OBJ_URL, this));
166
objectList.add(new StringSizeTerminated(DataTypes.OBJ_ID, this));