当前位置: 首页>>代码示例>>Java>>正文


Java FieldType.UNDEFINED属性代码示例

本文整理汇总了Java中org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType.UNDEFINED属性的典型用法代码示例。如果您正苦于以下问题:Java FieldType.UNDEFINED属性的具体用法?Java FieldType.UNDEFINED怎么用?Java FieldType.UNDEFINED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType的用法示例。


在下文中一共展示了FieldType.UNDEFINED属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TagInfoUndefined

public TagInfoUndefined(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
    super(name, tag, FieldType.UNDEFINED, length, directoryType);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:3,代码来源:TagInfoUndefined.java

示例2: TagInfoGpsText

public TagInfoGpsText(final String name, final int tag, final int length,
        final TiffDirectoryType exifDirectory) {
    super(name, tag, FieldType.UNDEFINED, length, exifDirectory);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:4,代码来源:TagInfoGpsText.java

示例3: TagInfoUndefineds

public TagInfoUndefineds(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
    super(name, tag, FieldType.UNDEFINED, length, directoryType);
}
 
开发者ID:apache,项目名称:commons-imaging,代码行数:3,代码来源:TagInfoUndefineds.java

示例4: TagInfoUndefined

public TagInfoUndefined(final String name, final int tag, final TiffDirectoryType directoryType) {
    super(name, tag, FieldType.UNDEFINED, directoryType);
}
 
开发者ID:apache,项目名称:commons-imaging,代码行数:3,代码来源:TagInfoUndefined.java

示例5: TagInfoGpsText

public TagInfoGpsText(final String name, final int tag,
        final TiffDirectoryType exifDirectory) {
    super(name, tag, FieldType.UNDEFINED, LENGTH_UNKNOWN, exifDirectory);
}
 
开发者ID:apache,项目名称:commons-imaging,代码行数:4,代码来源:TagInfoGpsText.java

示例6: getValue

@Override
public String getValue(final TiffField entry) throws ImageReadException {
    if (entry.getFieldType() == FieldType.ASCII) {
        final Object object = FieldType.ASCII.getValue(entry);
        if (object instanceof String) {
            return (String) object;
        } else if (object instanceof String[]) {
            // Use of arrays with the ASCII type
            // should be extremely rare, and use of
            // ASCII type in GPS fields should be
            // forbidden. So assume the 2 never happen
            // together and return incomplete strings if they do.
            return ((String[]) object)[0];
        } else {
            throw new ImageReadException("Unexpected ASCII type decoded");
        }
    } else if (entry.getFieldType() == FieldType.UNDEFINED) {
        /* later */
    } else if (entry.getFieldType() == FieldType.BYTE) {
        /* later */
    } else {
        Debug.debug("entry.type: " + entry.getFieldType());
        Debug.debug("entry.directoryType: " + entry.getDirectoryType());
        Debug.debug("entry.type: " + entry.getDescriptionWithoutValue());
        Debug.debug("entry.type: " + entry.getFieldType());
        throw new ImageReadException("GPS text field not encoded as bytes.");
    }

    final byte[] bytes = entry.getByteArrayValue();
    if (bytes.length < 8) {
        // try ASCII, with NO prefix.
        return new String(bytes, StandardCharsets.US_ASCII);
    }

    for (final TextEncoding encoding : TEXT_ENCODINGS) {
        if (BinaryFunctions.compareBytes(bytes, 0, encoding.prefix, 0,
                encoding.prefix.length)) {
            try {
                final String decodedString = new String(
                        bytes, encoding.prefix.length,
                        bytes.length - encoding.prefix.length,
                        encoding.encodingName);
                final byte[] reEncodedBytes = decodedString.getBytes(
                        encoding.encodingName);
                if (BinaryFunctions.compareBytes(bytes, encoding.prefix.length,
                        reEncodedBytes, 0,
                        reEncodedBytes.length)) {
                    return decodedString;
                }
            } catch (final UnsupportedEncodingException e) {
                throw new ImageReadException(e.getMessage(), e);
            }
        }
    }

    // try ASCII, with NO prefix.
    return new String(bytes, StandardCharsets.US_ASCII);
}
 
开发者ID:apache,项目名称:commons-imaging,代码行数:58,代码来源:TagInfoGpsText.java


注:本文中的org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType.UNDEFINED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。