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 | package com.drew.metadata.exif;
|
---|
16 |
|
---|
17 | import com.drew.metadata.Directory;
|
---|
18 | import com.drew.metadata.MetadataException;
|
---|
19 | import com.drew.metadata.TagDescriptor;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Provides human-readable string versions of the tags stored in a KyoceraMakernoteDirectory.
|
---|
23 | *
|
---|
24 | * Some information about this makernote taken from here:
|
---|
25 | * http://www.ozhiker.com/electronics/pjmt/jpeg_info/kyocera_mn.html
|
---|
26 | *
|
---|
27 | * Most manufacturer's MakerNote counts the "offset to data" from the first byte
|
---|
28 | * of TIFF header (same as the other IFD), but Kyocera (along with Fujifilm) counts
|
---|
29 | * it from the first byte of MakerNote itself.
|
---|
30 | */
|
---|
31 | public class KyoceraMakernoteDescriptor extends TagDescriptor
|
---|
32 | {
|
---|
33 | public KyoceraMakernoteDescriptor(Directory directory)
|
---|
34 | {
|
---|
35 | super(directory);
|
---|
36 | }
|
---|
37 |
|
---|
38 | public String getDescription(int tagType) throws MetadataException
|
---|
39 | {
|
---|
40 | switch (tagType) {
|
---|
41 | case KyoceraMakernoteDirectory.TAG_KYOCERA_PRINT_IMAGE_MATCHING_INFO:
|
---|
42 | return getPrintImageMatchingInfoDescription();
|
---|
43 | case KyoceraMakernoteDirectory.TAG_KYOCERA_PROPRIETARY_THUMBNAIL:
|
---|
44 | return getProprietaryThumbnailDataDescription();
|
---|
45 | default:
|
---|
46 | return _directory.getString(tagType);
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | public String getPrintImageMatchingInfoDescription() throws MetadataException
|
---|
51 | {
|
---|
52 | if (!_directory.containsTag(KyoceraMakernoteDirectory.TAG_KYOCERA_PRINT_IMAGE_MATCHING_INFO)) return null;
|
---|
53 | byte[] bytes = _directory.getByteArray(KyoceraMakernoteDirectory.TAG_KYOCERA_PRINT_IMAGE_MATCHING_INFO);
|
---|
54 | return "(" + bytes.length + " bytes)";
|
---|
55 | }
|
---|
56 |
|
---|
57 | public String getProprietaryThumbnailDataDescription() throws MetadataException
|
---|
58 | {
|
---|
59 | if (!_directory.containsTag(KyoceraMakernoteDirectory.TAG_KYOCERA_PROPRIETARY_THUMBNAIL)) return null;
|
---|
60 | byte[] bytes = _directory.getByteArray(KyoceraMakernoteDirectory.TAG_KYOCERA_PROPRIETARY_THUMBNAIL);
|
---|
61 | return "(" + bytes.length + " bytes)";
|
---|
62 | }
|
---|
63 | }
|
---|