source: josm/trunk/src/com/drew/metadata/exif/ExifSubIFDDirectory.java@ 12187

Last change on this file since 12187 was 10862, checked in by Don-vip, 8 years ago

update to metadata-extractor 2.9.1

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.0 KB
Line 
1/*
2 * Copyright 2002-2016 Drew Noakes
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21package com.drew.metadata.exif;
22
23import java.util.Date;
24import java.util.HashMap;
25import java.util.TimeZone;
26
27import com.drew.lang.annotations.NotNull;
28import com.drew.lang.annotations.Nullable;
29
30/**
31 * Describes Exif tags from the SubIFD directory.
32 *
33 * @author Drew Noakes https://drewnoakes.com
34 */
35public class ExifSubIFDDirectory extends ExifDirectoryBase
36{
37 /** This tag is a pointer to the Exif Interop IFD. */
38 public static final int TAG_INTEROP_OFFSET = 0xA005;
39
40 public ExifSubIFDDirectory()
41 {
42 this.setDescriptor(new ExifSubIFDDescriptor(this));
43 }
44
45 @NotNull
46 protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>();
47
48 static
49 {
50 addExifTagNames(_tagNameMap);
51 }
52
53 @Override
54 @NotNull
55 public String getName()
56 {
57 return "Exif SubIFD";
58 }
59
60 @Override
61 @NotNull
62 protected HashMap<Integer, String> getTagNameMap()
63 {
64 return _tagNameMap;
65 }
66
67 /**
68 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
69 * representing the date and time when this image was captured. Attempts will be made to parse the
70 * values as though it is in the GMT {@link TimeZone}.
71 *
72 * @return A Date object representing when this image was captured, if possible, otherwise null
73 */
74 @Nullable
75 public Date getDateOriginal()
76 {
77 return getDateOriginal(null);
78 }
79
80 /**
81 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
82 * representing the date and time when this image was captured. Attempts will be made to parse the
83 * values as though it is in the {@link TimeZone} represented by the {@code timeZone} parameter
84 * (if it is non-null).
85 *
86 * @param timeZone the time zone to use
87 * @return A Date object representing when this image was captured, if possible, otherwise null
88 */
89 @Nullable
90 public Date getDateOriginal(TimeZone timeZone)
91 {
92 return getDate(TAG_DATETIME_ORIGINAL, getString(TAG_SUBSECOND_TIME_ORIGINAL), timeZone);
93 }
94
95 /**
96 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
97 * representing the date and time when this image was digitized. Attempts will be made to parse the
98 * values as though it is in the GMT {@link TimeZone}.
99 *
100 * @return A Date object representing when this image was digitized, if possible, otherwise null
101 */
102 @Nullable
103 public Date getDateDigitized()
104 {
105 return getDateDigitized(null);
106 }
107
108 /**
109 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
110 * representing the date and time when this image was digitized. Attempts will be made to parse the
111 * values as though it is in the {@link TimeZone} represented by the {@code timeZone} parameter
112 * (if it is non-null).
113 *
114 * @param timeZone the time zone to use
115 * @return A Date object representing when this image was digitized, if possible, otherwise null
116 */
117 @Nullable
118 public Date getDateDigitized(TimeZone timeZone)
119 {
120 return getDate(TAG_DATETIME_DIGITIZED, getString(TAG_SUBSECOND_TIME_DIGITIZED), timeZone);
121 }
122}
Note: See TracBrowser for help on using the repository browser.