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

Last change on this file since 13722 was 13061, checked in by Don-vip, 7 years ago

fix #15505 - update to metadata-extractor 2.10.1

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.1 KB
RevLine 
[6127]1/*
[13061]2 * Copyright 2002-2017 Drew Noakes
[6127]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 *
[8132]18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
[6127]20 */
21package com.drew.metadata.exif;
22
[13061]23import com.drew.lang.annotations.NotNull;
24import com.drew.lang.annotations.Nullable;
25
[10862]26import java.util.Date;
27import java.util.HashMap;
28import java.util.TimeZone;
29
[6127]30/**
31 * Describes Exif tags from the SubIFD directory.
32 *
[8132]33 * @author Drew Noakes https://drewnoakes.com
[6127]34 */
[13061]35@SuppressWarnings("WeakerAccess")
[8243]36public class ExifSubIFDDirectory extends ExifDirectoryBase
[6127]37{
[8132]38 /** This tag is a pointer to the Exif Interop IFD. */
39 public static final int TAG_INTEROP_OFFSET = 0xA005;
40
[8243]41 public ExifSubIFDDirectory()
42 {
43 this.setDescriptor(new ExifSubIFDDescriptor(this));
44 }
[6127]45
46 @NotNull
47 protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>();
48
49 static
50 {
[8243]51 addExifTagNames(_tagNameMap);
[6127]52 }
53
[8132]54 @Override
[6127]55 @NotNull
56 public String getName()
57 {
58 return "Exif SubIFD";
59 }
60
[8132]61 @Override
[6127]62 @NotNull
63 protected HashMap<Integer, String> getTagNameMap()
64 {
65 return _tagNameMap;
66 }
[10862]67
68 /**
69 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
70 * representing the date and time when this image was captured. Attempts will be made to parse the
71 * values as though it is in the GMT {@link TimeZone}.
72 *
73 * @return A Date object representing when this image was captured, if possible, otherwise null
74 */
75 @Nullable
76 public Date getDateOriginal()
77 {
78 return getDateOriginal(null);
79 }
80
81 /**
82 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
83 * representing the date and time when this image was captured. Attempts will be made to parse the
84 * values as though it is in the {@link TimeZone} represented by the {@code timeZone} parameter
85 * (if it is non-null).
86 *
87 * @param timeZone the time zone to use
88 * @return A Date object representing when this image was captured, if possible, otherwise null
89 */
90 @Nullable
[13061]91 public Date getDateOriginal(@Nullable TimeZone timeZone)
[10862]92 {
93 return getDate(TAG_DATETIME_ORIGINAL, getString(TAG_SUBSECOND_TIME_ORIGINAL), timeZone);
94 }
95
96 /**
97 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
98 * representing the date and time when this image was digitized. Attempts will be made to parse the
99 * values as though it is in the GMT {@link TimeZone}.
100 *
101 * @return A Date object representing when this image was digitized, if possible, otherwise null
102 */
103 @Nullable
104 public Date getDateDigitized()
105 {
106 return getDateDigitized(null);
107 }
108
109 /**
110 * Parses the date/time tag and the subsecond tag to obtain a single Date object with milliseconds
111 * representing the date and time when this image was digitized. Attempts will be made to parse the
112 * values as though it is in the {@link TimeZone} represented by the {@code timeZone} parameter
113 * (if it is non-null).
114 *
115 * @param timeZone the time zone to use
116 * @return A Date object representing when this image was digitized, if possible, otherwise null
117 */
118 @Nullable
[13061]119 public Date getDateDigitized(@Nullable TimeZone timeZone)
[10862]120 {
121 return getDate(TAG_DATETIME_DIGITIZED, getString(TAG_SUBSECOND_TIME_DIGITIZED), timeZone);
122 }
[6127]123}
Note: See TracBrowser for help on using the repository browser.