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


Java TiffMetadataReader类代码示例

本文整理汇总了Java中com.drew.imaging.tiff.TiffMetadataReader的典型用法代码示例。如果您正苦于以下问题:Java TiffMetadataReader类的具体用法?Java TiffMetadataReader怎么用?Java TiffMetadataReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: readMetadata

import com.drew.imaging.tiff.TiffMetadataReader; //导入依赖的package包/类
private static Metadata readMetadata(BufferedInputStream inputStream, File file, int magicNumber) throws ImageProcessingException
{
    if ((magicNumber & JPEG_FILE_MAGIC_NUMBER)==JPEG_FILE_MAGIC_NUMBER) {
        if (inputStream!=null)
            return JpegMetadataReader.readMetadata(inputStream);
        else
            return JpegMetadataReader.readMetadata(file);
    } else if (magicNumber==INTEL_TIFF_MAGIC_NUMBER || magicNumber==MOTOROLLA_TIFF_MAGIC_NUMBER) {
        if (inputStream!=null)
            return TiffMetadataReader.readMetadata(inputStream);
        else
            return TiffMetadataReader.readMetadata(file);
    } else {
        throw new ImageProcessingException("File is not the correct format");
    }
}
 
开发者ID:ecologylab,项目名称:BigSemanticsJava,代码行数:17,代码来源:ImageMetadataReader.java

示例2: tiff

import com.drew.imaging.tiff.TiffMetadataReader; //导入依赖的package包/类
private static void tiff(Resource res,Struct info) {
	InputStream is=null;
	try {
		is = res.getInputStream();
		fill(info,TiffMetadataReader.readMetadata(is,true));
	}
	catch(Throwable t) {
		ExceptionUtil.rethrowIfNecessary(t);
		//throw Caster.toPageException(t);
	}
	finally {
		IOUtil.closeEL(is);
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:15,代码来源:ImageMetaDrew.java

示例3: tiff

import com.drew.imaging.tiff.TiffMetadataReader; //导入依赖的package包/类
private static void tiff(Resource res,Struct info) {
	InputStream is=null;
	try {
		is = res.getInputStream();
		fill(info,TiffMetadataReader.readMetadata(is));
	}
	catch(Throwable t) {
		ExceptionUtil.rethrowIfNecessary(t);
		//throw Caster.toPageException(t);
	}
	finally {
		IOUtil.closeEL(is);
	}
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:15,代码来源:ImageMetaDrew.java

示例4: parseTiff

import com.drew.imaging.tiff.TiffMetadataReader; //导入依赖的package包/类
public void parseTiff(File file)
        throws IOException, SAXException, TikaException {
    try {
        com.drew.metadata.Metadata tiffMetadata = TiffMetadataReader.readMetadata(file);
        handle(tiffMetadata);
    } catch (MetadataException e) {
        throw new TikaException("Can't read TIFF metadata", e);
    }
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:10,代码来源:ImageMetadataExtractor.java

示例5: readMetadata

import com.drew.imaging.tiff.TiffMetadataReader; //导入依赖的package包/类
@NotNull
private static Metadata readMetadata(@Nullable BufferedInputStream inputStream, @Nullable File file, int magicNumber, boolean waitForBytes) throws ImageProcessingException, IOException
{
    assert(file!=null ^ inputStream!=null);
    
    // This covers all JPEG files
    if ((magicNumber & JPEG_FILE_MAGIC_NUMBER) == JPEG_FILE_MAGIC_NUMBER) {
        if (inputStream != null)
            return JpegMetadataReader.readMetadata(inputStream, waitForBytes);
        else
            return JpegMetadataReader.readMetadata(file);
    }

    // This covers all TIFF and camera RAW files
    if (magicNumber == INTEL_TIFF_MAGIC_NUMBER || magicNumber == MOTOROLA_TIFF_MAGIC_NUMBER) {
        if (inputStream != null)
            return TiffMetadataReader.readMetadata(inputStream, waitForBytes);
        else
            return TiffMetadataReader.readMetadata(file);
    }

    // This covers PSD files
    // TODO we should really check all 4 bytes of the PSD magic number
    if (magicNumber == PSD_MAGIC_NUMBER) {
        if (inputStream != null)
            return PsdMetadataReader.readMetadata(inputStream, waitForBytes);
        else
            return PsdMetadataReader.readMetadata(file);
    }

    throw new ImageProcessingException("File format is not supported");
}
 
开发者ID:mxbossard,项目名称:metadata-extractor-osgi,代码行数:33,代码来源:ImageMetadataReader.java

示例6: readMetadata

import com.drew.imaging.tiff.TiffMetadataReader; //导入依赖的package包/类
/**
 * Reads metadata from an {@link InputStream} of known length and file type.
 *
 * @param inputStream a stream from which the file data may be read.  The stream must be positioned at the
 *                    beginning of the file's data.
 * @param streamLength the length of the stream, if known, otherwise -1.
 * @param fileType the file type of the data stream.
 * @return a populated {@link Metadata} object containing directories of tags with values and any processing errors.
 * @throws ImageProcessingException if the file type is unknown, or for general processing errors.
 */
@NotNull
public static Metadata readMetadata(@NotNull final InputStream inputStream, final long streamLength, final FileType fileType) throws IOException, ImageProcessingException
{
    switch (fileType) {
        case Jpeg:
            return JpegMetadataReader.readMetadata(inputStream);
        case Tiff:
        case Arw:
        case Cr2:
        case Nef:
        case Orf:
        case Rw2:
            return TiffMetadataReader.readMetadata(new RandomAccessStreamReader(inputStream, RandomAccessStreamReader.DEFAULT_CHUNK_LENGTH, streamLength));
        case Psd:
            return PsdMetadataReader.readMetadata(inputStream);
        case Png:
            return PngMetadataReader.readMetadata(inputStream);
        case Bmp:
            return BmpMetadataReader.readMetadata(inputStream);
        case Gif:
            return GifMetadataReader.readMetadata(inputStream);
        case Ico:
            return IcoMetadataReader.readMetadata(inputStream);
        case Pcx:
            return PcxMetadataReader.readMetadata(inputStream);
        case WebP:
            return WebpMetadataReader.readMetadata(inputStream);
        case Raf:
            return RafMetadataReader.readMetadata(inputStream);
        case Avi:
            return AviMetadataReader.readMetadata(inputStream);
        case Wav:
            return WavMetadataReader.readMetadata(inputStream);
        case Mov:
            return QuickTimeMetadataReader.readMetadata(inputStream);
        case Mp4:
            return Mp4MetadataReader.readMetadata(inputStream);
        case Eps:
            return EpsMetadataReader.readMetadata(inputStream);
        case Heif:
            return HeifMetadataReader.readMetadata(inputStream);
        case Unknown:
            throw new ImageProcessingException("File format could not be determined");
        default:
            return new Metadata();
    }
}
 
开发者ID:drewnoakes,项目名称:metadata-extractor,代码行数:58,代码来源:ImageMetadataReader.java

示例7: readMetadata

import com.drew.imaging.tiff.TiffMetadataReader; //导入依赖的package包/类
/**
 * Reads metadata from an {@link InputStream}.
 * <p/>
 * The file type is determined by inspecting the leading bytes of the stream, and parsing of the file
 * is delegated to one of:
 * <ul>
 *     <li>{@link JpegMetadataReader} for JPEG files</li>
 *     <li>{@link TiffMetadataReader} for TIFF and (most) RAW files</li>
 *     <li>{@link PsdMetadataReader} for Photoshop files</li>
 *     <li>{@link PngMetadataReader} for PNG files</li>
 *     <li>{@link BmpMetadataReader} for BMP files</li>
 *     <li>{@link GifMetadataReader} for GIF files</li>
 * </ul>
 *
 * @param inputStream a stream from which the file data may be read.  The stream must be positioned at the
 *                    beginning of the file's data.
 * @return a populated {@link Metadata} object containing directories of tags with values and any processing errors.
 * @throws ImageProcessingException if the file type is unknown, or for general processing errors.
 */
@NotNull
public static Metadata readMetadata(@NotNull final InputStream inputStream) throws ImageProcessingException, IOException
{
    InputStream bufferedInputStream = inputStream instanceof BufferedInputStream ? inputStream : new BufferedInputStream(inputStream);

    int magicNumber = peekMagicNumber(bufferedInputStream);

    if (magicNumber == -1)
        throw new ImageProcessingException("Could not determine file's magic number.");

    // This covers all JPEG files
    if ((magicNumber & JPEG_FILE_MAGIC_NUMBER) == JPEG_FILE_MAGIC_NUMBER) {
        return JpegMetadataReader.readMetadata(bufferedInputStream);
    }

    // This covers all TIFF and camera RAW files
    if (magicNumber == INTEL_TIFF_MAGIC_NUMBER || magicNumber == MOTOROLA_TIFF_MAGIC_NUMBER) {
        return TiffMetadataReader.readMetadata(bufferedInputStream);
    }

    // This covers PSD files
    // TODO we should really check all 4 bytes of the PSD magic number
    if (magicNumber == PSD_MAGIC_NUMBER) {
        return PsdMetadataReader.readMetadata(bufferedInputStream);
    }

    // This covers BMP files
    if (magicNumber == PNG_MAGIC_NUMBER) {
        return PngMetadataReader.readMetadata(bufferedInputStream);
    }

    // This covers BMP files
    if (magicNumber == BMP_MAGIC_NUMBER) {
        return BmpMetadataReader.readMetadata(bufferedInputStream);
    }

    // This covers GIF files
    if (magicNumber == GIF_MAGIC_NUMBER) {
        return GifMetadataReader.readMetadata(bufferedInputStream);
    }

    throw new ImageProcessingException("File format is not supported");
}
 
开发者ID:byronb92,项目名称:ImageEXIFExtraction,代码行数:63,代码来源:ImageMetadataReader.java


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