| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TagField |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Entagged Audio Tag library | |
| 3 | * Copyright (c) 2003-2005 Rapha�l Slinckx <raphael@slinckx.net> | |
| 4 | * | |
| 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. | |
| 9 | * | |
| 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. | |
| 14 | * | |
| 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 | |
| 18 | */ | |
| 19 | package org.jaudiotagger.tag; | |
| 20 | ||
| 21 | import java.io.UnsupportedEncodingException; | |
| 22 | ||
| 23 | /** | |
| 24 | * Implementing classes represent a tag field for the entagged audio library.<br> | |
| 25 | * Very basic functionality is defined for use with | |
| 26 | * {@link org.jaudiotagger.tag.Tag}. | |
| 27 | * | |
| 28 | * @author Rapha�l Slinckx | |
| 29 | */ | |
| 30 | public interface TagField | |
| 31 | { | |
| 32 | ||
| 33 | /** | |
| 34 | * This method copies the data of the given field to the current data.<br> | |
| 35 | * | |
| 36 | * @param field The field containing the data to be taken. | |
| 37 | */ | |
| 38 | public void copyContent(TagField field); | |
| 39 | ||
| 40 | /** | |
| 41 | * Returns the Id of the represented tag field.<br> | |
| 42 | * This value should uniquely identify a kind of tag data, like title. | |
| 43 | * {@link org.jaudiotagger.audio.generic.AbstractTag} will use the "id" to summarize multiple | |
| 44 | * fields. | |
| 45 | * | |
| 46 | * @return Unique identifier for the fields type. (title, artist...) | |
| 47 | */ | |
| 48 | public String getId(); | |
| 49 | ||
| 50 | /** | |
| 51 | * This method delivers the binary representation of the fields data in | |
| 52 | * order to be directly written to the file.<br> | |
| 53 | * | |
| 54 | * @return Binary data representing the current tag field.<br> | |
| 55 | * @throws UnsupportedEncodingException Most tag data represents text. In some cases the underlying | |
| 56 | * implementation will need to convert the text data in java to | |
| 57 | * a specific charset encoding. In these cases an | |
| 58 | * {@link UnsupportedEncodingException} may occur. | |
| 59 | */ | |
| 60 | public byte[] getRawContent() throws UnsupportedEncodingException; | |
| 61 | ||
| 62 | /** | |
| 63 | * Determines whether the represented field contains (is made up of) binary | |
| 64 | * data, instead of text data.<br> | |
| 65 | * Software can identify fields to be displayed because they are human | |
| 66 | * readable if this method returns <code>false</code>. | |
| 67 | * | |
| 68 | * @return <code>true</code> if field represents binary data (not human | |
| 69 | * readable). | |
| 70 | */ | |
| 71 | public boolean isBinary(); | |
| 72 | ||
| 73 | /** | |
| 74 | * This method will set the field to represent binary data.<br> | |
| 75 | * <p/> | |
| 76 | * Some implementations may support conversions.<br> | |
| 77 | * As of now (Octobre 2005) there is no implementation really using this | |
| 78 | * method to perform useful operations. | |
| 79 | * | |
| 80 | * @param b <code>true</code>, if the field contains binary data. | |
| 81 | * //@deprecated As for now is of no use. Implementations should use another | |
| 82 | * // way of setting this property. | |
| 83 | */ | |
| 84 | public void isBinary(boolean b); | |
| 85 | ||
| 86 | /** | |
| 87 | * Identifies a field to be of common use.<br> | |
| 88 | * <p/> | |
| 89 | * Some software may differ between common and not common fields. A common | |
| 90 | * one is for sure the title field. A web link may not be of common use for | |
| 91 | * tagging. However some file formats, or future development of users | |
| 92 | * expectations will make more fields common than now can be known. | |
| 93 | * | |
| 94 | * @return <code>true</code> if the field is of common use. | |
| 95 | */ | |
| 96 | public boolean isCommon(); | |
| 97 | ||
| 98 | /** | |
| 99 | * Determines whether the content of the field is empty.<br> | |
| 100 | * | |
| 101 | * @return <code>true</code> if no data is stored (or empty String). | |
| 102 | */ | |
| 103 | public boolean isEmpty(); | |
| 104 | ||
| 105 | /** | |
| 106 | * This method returns a human readable description of the fields contents.<br> | |
| 107 | * For text fields it should be the text itself. Other fields containing | |
| 108 | * images may return a formatted string with image properties like width, | |
| 109 | * height and so on. | |
| 110 | * | |
| 111 | * @return Description of the fields content. | |
| 112 | */ | |
| 113 | public String toString(); | |
| 114 | } |