Changeset 6127 in josm for trunk/src/com/drew/metadata/exif/OlympusMakernoteDescriptor.java
- Timestamp:
- 2013-08-09T18:05:11+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/exif/OlympusMakernoteDescriptor.java
r4231 r6127 1 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. 2 * Copyright 2002-2012 Drew Noakes 6 3 * 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. 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 9 7 * 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/ 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 * http://drewnoakes.com/code/exif/ 19 * http://code.google.com/p/metadata-extractor/ 14 20 */ 15 21 package com.drew.metadata.exif; 16 22 17 import com.drew. metadata.Directory;18 import com.drew. metadata.MetadataException;23 import com.drew.lang.annotations.NotNull; 24 import com.drew.lang.annotations.Nullable; 19 25 import com.drew.metadata.TagDescriptor; 20 26 21 27 /** 22 * Provides human-readable string versions of the tags stored in an OlympusMakernoteDirectory. 28 * Provides human-readable string representations of tag values stored in a <code>OlympusMakernoteDirectory</code>. 29 * 30 * @author Drew Noakes http://drewnoakes.com 23 31 */ 24 public class OlympusMakernoteDescriptor extends TagDescriptor 32 public class OlympusMakernoteDescriptor extends TagDescriptor<OlympusMakernoteDirectory> 25 33 { 26 public OlympusMakernoteDescriptor(Directory directory) 34 public OlympusMakernoteDescriptor(@NotNull OlympusMakernoteDirectory directory) 27 35 { 28 36 super(directory); 29 37 } 30 38 31 public String getDescription(int tagType) throws MetadataException 39 @Nullable 40 public String getDescription(int tagType) 32 41 { 33 42 switch (tagType) { … … 41 50 return getDigiZoomRatioDescription(); 42 51 default: 43 return _directory.getString(tagType);52 return super.getDescription(tagType); 44 53 } 45 54 } 46 55 47 public String getDigiZoomRatioDescription() throws MetadataException 56 @Nullable 57 public String getDigiZoomRatioDescription() 48 58 { 49 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO)) return null; 50 int value = _directory.getInt(OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO); 59 Integer value = _directory.getInteger(OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO); 60 if (value==null) 61 return null; 51 62 switch (value) { 52 63 case 0: … … 59 70 } 60 71 61 public String getMacroModeDescription() throws MetadataException 72 @Nullable 73 public String getMacroModeDescription() 62 74 { 63 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE)) return null; 64 int value = _directory.getInt(OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE); 75 Integer value = _directory.getInteger(OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE); 76 if (value==null) 77 return null; 65 78 switch (value) { 66 79 case 0: … … 73 86 } 74 87 75 public String getJpegQualityDescription() throws MetadataException 88 @Nullable 89 public String getJpegQualityDescription() 76 90 { 77 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY)) return null; 78 int value = _directory.getInt(OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY); 91 Integer value = _directory.getInteger(OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY); 92 if (value==null) 93 return null; 79 94 switch (value) { 80 95 case 1: … … 89 104 } 90 105 91 public String getSpecialModeDescription() throws MetadataException 106 @Nullable 107 public String getSpecialModeDescription() 92 108 { 93 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE)) return null;94 109 int[] values = _directory.getIntArray(OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE); 95 StringBuffer desc = new StringBuffer(); 110 if (values==null) 111 return null; 112 if (values.length < 1) 113 return ""; 114 StringBuilder desc = new StringBuilder(); 96 115 switch (values[0]) { 97 116 case 0: … … 111 130 break; 112 131 } 132 133 if (values.length < 2) 134 return desc.toString(); 113 135 desc.append(" - "); 114 136 switch (values[1]) { … … 117 139 break; 118 140 case 1: 119 desc.append("1st in a sequnce"); 141 desc.append("1st in a sequence"); 120 142 break; 121 143 case 2: … … 130 152 break; 131 153 } 154 if (values.length < 3) 155 return desc.toString(); 156 desc.append(" - "); 132 157 switch (values[2]) { 133 158 case 1:
Note:
See TracChangeset
for help on using the changeset viewer.