2
* Entagged Audio Tag library
3
* Copyright (c) 2004-2005 Christian Laireiter <liree@web.de>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
package org.jaudiotagger.tag.asf;
21
import org.jaudiotagger.audio.asf.data.MetadataDescriptor;
22
import org.jaudiotagger.tag.TagField;
23
import org.jaudiotagger.tag.asf.AsfFieldKey;
24
import org.jaudiotagger.tag.asf.AsfTag;
27
* This class encapsulates a
28
* {@link org.jaudiotagger.audio.asf.data.MetadataDescriptor}and provides access
30
* The metadata descriptor used for construction is copied.
32
* @author Christian Laireiter (liree)
34
public class AsfTagField implements TagField, Cloneable {
37
* This descriptor is wrapped.
39
protected MetadataDescriptor toWrap;
42
* Creates a tag field.
45
* the ASF field that should be represented.
47
public AsfTagField(final AsfFieldKey field) {
49
this.toWrap = new MetadataDescriptor(field.getHighestContainer(), field
50
.getFieldName(), MetadataDescriptor.TYPE_STRING);
54
* Creates an instance.
57
* The descriptor which should be represented as a
60
public AsfTagField(final MetadataDescriptor source) {
61
assert source != null;
62
// XXX Copy ? maybe not really.
63
this.toWrap = source.createCopy();
67
* Creates a tag field.
70
* The field identifier to use.
72
public AsfTagField(final String fieldKey) {
73
assert fieldKey != null;
74
this.toWrap = new MetadataDescriptor(AsfFieldKey.getAsfFieldKey(
75
fieldKey).getHighestContainer(), fieldKey,
76
MetadataDescriptor.TYPE_STRING);
83
public Object clone() throws CloneNotSupportedException {
90
public void copyContent(final TagField field) {
91
throw new UnsupportedOperationException("Not implemented yet.");
95
* Returns the wrapped metadata descriptor (which actually stores the
98
* @return the wrapped metadata descriptor
100
public MetadataDescriptor getDescriptor() {
107
public String getId() {
108
return this.toWrap.getName();
114
public byte[] getRawContent() {
115
return this.toWrap.getRawData();
121
public boolean isBinary() {
122
return this.toWrap.getType() == MetadataDescriptor.TYPE_BINARY;
128
public void isBinary(final boolean value) {
129
if (!value && isBinary()) {
130
throw new UnsupportedOperationException("No conversion supported.");
132
this.toWrap.setBinaryValue(this.toWrap.getRawData());
138
public boolean isCommon() {
139
// HashSet is safe against null comparison
140
return AsfTag.COMMON_FIELDS.contains(AsfFieldKey
141
.getAsfFieldKey(getId()));
147
public boolean isEmpty() {
148
return this.toWrap.isEmpty();
155
public String toString() {
156
return this.toWrap.getString();
b'\\ No newline at end of file'