Ignore:
Timestamp:
2013-08-09T18:05:11+02:00 (12 years ago)
Author:
bastiK
Message:

applied #8895 - Upgrade metadata-extractor to v. 2.6.4 (patch by ebourg)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/drew/metadata/exif/OlympusMakernoteDescriptor.java

    r4231 r6127  
    11/*
    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
    63 *
    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
    97 *
    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/
    1420 */
    1521package com.drew.metadata.exif;
    1622
    17 import com.drew.metadata.Directory;
    18 import com.drew.metadata.MetadataException;
     23import com.drew.lang.annotations.NotNull;
     24import com.drew.lang.annotations.Nullable;
    1925import com.drew.metadata.TagDescriptor;
    2026
    2127/**
    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
    2331 */
    24 public class OlympusMakernoteDescriptor extends TagDescriptor
     32public class OlympusMakernoteDescriptor extends TagDescriptor<OlympusMakernoteDirectory>
    2533{
    26     public OlympusMakernoteDescriptor(Directory directory)
     34    public OlympusMakernoteDescriptor(@NotNull OlympusMakernoteDirectory directory)
    2735    {
    2836        super(directory);
    2937    }
    3038
    31     public String getDescription(int tagType) throws MetadataException
     39    @Nullable
     40    public String getDescription(int tagType)
    3241    {
    3342        switch (tagType) {
     
    4150                return getDigiZoomRatioDescription();
    4251            default:
    43                 return _directory.getString(tagType);
     52                return super.getDescription(tagType);
    4453        }
    4554    }
    4655
    47     public String getDigiZoomRatioDescription() throws MetadataException
     56    @Nullable
     57    public String getDigiZoomRatioDescription()
    4858    {
    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;
    5162        switch (value) {
    5263            case 0:
     
    5970    }
    6071
    61     public String getMacroModeDescription() throws MetadataException
     72    @Nullable
     73    public String getMacroModeDescription()
    6274    {
    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;
    6578        switch (value) {
    6679            case 0:
     
    7386    }
    7487
    75     public String getJpegQualityDescription() throws MetadataException
     88    @Nullable
     89    public String getJpegQualityDescription()
    7690    {
    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;
    7994        switch (value) {
    8095            case 1:
     
    89104    }
    90105
    91     public String getSpecialModeDescription() throws MetadataException
     106    @Nullable
     107    public String getSpecialModeDescription()
    92108    {
    93         if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE)) return null;
    94109        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();
    96115        switch (values[0]) {
    97116            case 0:
     
    111130                break;
    112131        }
     132
     133        if (values.length < 2)
     134            return desc.toString();
    113135        desc.append(" - ");
    114136        switch (values[1]) {
     
    117139                break;
    118140            case 1:
    119                 desc.append("1st in a sequnce");
     141                desc.append("1st in a sequence");
    120142                break;
    121143            case 2:
     
    130152                break;
    131153        }
     154        if (values.length < 3)
     155            return desc.toString();
     156        desc.append(" - ");
    132157        switch (values[2]) {
    133158            case 1:
Note: See TracChangeset for help on using the changeset viewer.