1 | /*
|
---|
2 | * This is public domain software - that is, you can do whatever you want
|
---|
3 | * with it, and include it software that is licensed under the GNU or the
|
---|
4 | * BSD license, or whatever other licence you choose, including proprietary
|
---|
5 | * closed source licenses. I do ask that you leave this header in tact.
|
---|
6 | *
|
---|
7 | * If you make modifications to this code that you think would benefit the
|
---|
8 | * wider community, please send me a copy and I'll post it on my site.
|
---|
9 | *
|
---|
10 | * If you make use of this code, I'd appreciate hearing about it.
|
---|
11 | * drew@drewnoakes.com
|
---|
12 | * Latest version of this software kept at
|
---|
13 | * http://drewnoakes.com/
|
---|
14 | *
|
---|
15 | * Created by dnoakes on 12-Nov-2002 22:27:34 using IntelliJ IDEA.
|
---|
16 | */
|
---|
17 | package com.drew.metadata.exif;
|
---|
18 |
|
---|
19 | import com.drew.metadata.Directory;
|
---|
20 | import com.drew.metadata.MetadataException;
|
---|
21 | import com.drew.metadata.TagDescriptor;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | *
|
---|
25 | */
|
---|
26 | public class ExifInteropDescriptor extends TagDescriptor
|
---|
27 | {
|
---|
28 | public ExifInteropDescriptor(Directory directory)
|
---|
29 | {
|
---|
30 | super(directory);
|
---|
31 | }
|
---|
32 |
|
---|
33 | public String getDescription(int tagType) throws MetadataException
|
---|
34 | {
|
---|
35 | switch (tagType) {
|
---|
36 | case ExifInteropDirectory.TAG_INTEROP_INDEX:
|
---|
37 | return getInteropIndexDescription();
|
---|
38 | case ExifInteropDirectory.TAG_INTEROP_VERSION:
|
---|
39 | return getInteropVersionDescription();
|
---|
40 | default:
|
---|
41 | return _directory.getString(tagType);
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
45 | public String getInteropVersionDescription() throws MetadataException
|
---|
46 | {
|
---|
47 | if (!_directory.containsTag(ExifInteropDirectory.TAG_INTEROP_VERSION)) return null;
|
---|
48 | int[] ints = _directory.getIntArray(ExifInteropDirectory.TAG_INTEROP_VERSION);
|
---|
49 | return ExifDescriptor.convertBytesToVersionString(ints);
|
---|
50 | }
|
---|
51 |
|
---|
52 | public String getInteropIndexDescription()
|
---|
53 | {
|
---|
54 | if (!_directory.containsTag(ExifInteropDirectory.TAG_INTEROP_INDEX)) return null;
|
---|
55 | String interopIndex = _directory.getString(ExifInteropDirectory.TAG_INTEROP_INDEX).trim();
|
---|
56 | if ("R98".equalsIgnoreCase(interopIndex)) {
|
---|
57 | return "Recommended Exif Interoperability Rules (ExifR98)";
|
---|
58 | } else {
|
---|
59 | return "Unknown (" + interopIndex + ")";
|
---|
60 | }
|
---|
61 | }
|
---|
62 | }
|
---|