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

« back to all changes in this revision

Viewing changes to src/org/jaudiotagger/tag/asf/AbstractAsfTagImageField.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-04-28 23:52:43 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110428235243-pzalvw6lncis3ukf
Tags: 2.0.3-1
* d/control: Drop Depends on default-jre per Debian Java Policy as its
  a library package.
* d/watch: Fix to directly monitor SVN tags.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.2 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.jaudiotagger.tag.asf;
 
2
 
 
3
import org.jaudiotagger.audio.asf.data.MetadataDescriptor;
 
4
import org.jaudiotagger.tag.asf.AsfTagField;
 
5
import org.jaudiotagger.tag.asf.AsfFieldKey;
 
6
import org.jaudiotagger.tag.TagField;
 
7
 
 
8
import javax.imageio.ImageIO;
 
9
 
 
10
import java.awt.image.BufferedImage;
 
11
import java.io.ByteArrayInputStream;
 
12
import java.io.IOException;
 
13
 
 
14
/**
 
15
 * An <code>AbstractAsfTagImageField</code> is an abstract class for representing tag
 
16
 * fields containing image data.<br>
 
17
 * 
 
18
 * @author Christian Laireiter
 
19
 */
 
20
abstract class AbstractAsfTagImageField extends AsfTagField
 
21
{
 
22
 
 
23
    /**
 
24
     * Creates a image tag field.
 
25
     * 
 
26
     * @param field
 
27
     *            the ASF field that should be represented.
 
28
     */
 
29
    public AbstractAsfTagImageField(final AsfFieldKey field) {
 
30
        super(field);
 
31
    }
 
32
 
 
33
    /**
 
34
     * Creates an instance.
 
35
     * 
 
36
     * @param source
 
37
     *            The descriptor which should be represented as a
 
38
     *            {@link TagField}.
 
39
     */
 
40
    public AbstractAsfTagImageField(final MetadataDescriptor source) {
 
41
        super(source);
 
42
    }
 
43
 
 
44
    /**
 
45
     * Creates a tag field.
 
46
     * 
 
47
     * @param fieldKey
 
48
     *            The field identifier to use.
 
49
     */
 
50
    public AbstractAsfTagImageField(final String fieldKey) {
 
51
        super(fieldKey);
 
52
    }
 
53
 
 
54
    /**
 
55
     * This method returns an image instance from the
 
56
     * {@linkplain #getRawImageData() image content}.
 
57
     * 
 
58
     * @return the image instance
 
59
     * @throws IOException
 
60
     */
 
61
    public BufferedImage getImage() throws IOException {
 
62
        return ImageIO.read(new ByteArrayInputStream(getRawImageData()));
 
63
    }
 
64
 
 
65
    /**
 
66
     * Returns the size of the {@linkplain #getRawImageData() image data}.<br>
 
67
     * 
 
68
     * @return image data size in bytes.
 
69
     */
 
70
    public abstract int getImageDataSize();
 
71
 
 
72
    /**
 
73
     * Returns the raw data of the represented image.<br>
 
74
     * 
 
75
     * @return raw image data
 
76
     */
 
77
    public abstract byte[] getRawImageData();
 
78
 
 
79
}