當前位置: 首頁>>代碼示例>>Java>>正文


Java TiffConstants.COMPRESSION_LZW屬性代碼示例

本文整理匯總了Java中mil.nga.tiff.util.TiffConstants.COMPRESSION_LZW屬性的典型用法代碼示例。如果您正苦於以下問題:Java TiffConstants.COMPRESSION_LZW屬性的具體用法?Java TiffConstants.COMPRESSION_LZW怎麽用?Java TiffConstants.COMPRESSION_LZW使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在mil.nga.tiff.util.TiffConstants的用法示例。


在下文中一共展示了TiffConstants.COMPRESSION_LZW屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEncoder

/**
 * Get the compression encoder
 * 
 * @param fileDirectory
 *            file directory
 * @return encoder
 */
@SuppressWarnings("deprecation")
private static CompressionEncoder getEncoder(FileDirectory fileDirectory) {

	CompressionEncoder encoder = null;

	// Determine the encoder based upon the compression
	Integer compression = fileDirectory.getCompression();
	if (compression == null) {
		compression = TiffConstants.COMPRESSION_NO;
	}

	switch (compression) {
	case TiffConstants.COMPRESSION_NO:
		encoder = new RawCompression();
		break;
	case TiffConstants.COMPRESSION_CCITT_HUFFMAN:
		throw new TiffException("CCITT Huffman compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_T4:
		throw new TiffException("T4-encoding compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_T6:
		throw new TiffException("T6-encoding compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_LZW:
		encoder = new LZWCompression();
		break;
	case TiffConstants.COMPRESSION_JPEG_OLD:
	case TiffConstants.COMPRESSION_JPEG_NEW:
		throw new TiffException("JPEG compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_DEFLATE:
	case TiffConstants.COMPRESSION_PKZIP_DEFLATE:
		encoder = new DeflateCompression();
		break;
	case TiffConstants.COMPRESSION_PACKBITS:
		encoder = new PackbitsCompression();
		break;
	default:
		throw new TiffException("Unknown compression method identifier: "
				+ compression);
	}

	return encoder;
}
 
開發者ID:ngageoint,項目名稱:tiff-java,代碼行數:52,代碼來源:TiffWriter.java

示例2: FileDirectory

/**
 * Constructor, for reading TIFF files
 * 
 * @param entries
 *            file directory entries
 * @param reader
 *            TIFF file byte reader
 * @param cacheData
 *            true to cache tiles and strips
 */
public FileDirectory(SortedSet<FileDirectoryEntry> entries,
		ByteReader reader, boolean cacheData) {
	// Set the entries and the field tag type mapping
	this.entries = entries;
	for (FileDirectoryEntry entry : entries) {
		fieldTagTypeMapping.put(entry.getFieldTag(), entry);
	}

	this.reader = reader;

	// Set the cache
	setCache(cacheData);

	// Determine if tiled
	tiled = getRowsPerStrip() == null;

	// Determine and validate the planar configuration
	Integer pc = getPlanarConfiguration();
	planarConfiguration = pc != null ? pc
			: TiffConstants.PLANAR_CONFIGURATION_CHUNKY;
	if (planarConfiguration != TiffConstants.PLANAR_CONFIGURATION_CHUNKY
			&& planarConfiguration != TiffConstants.PLANAR_CONFIGURATION_PLANAR) {
		throw new TiffException("Invalid planar configuration: "
				+ planarConfiguration);
	}

	// Determine the decoder based upon the compression
	Integer compression = getCompression();
	if (compression == null) {
		compression = TiffConstants.COMPRESSION_NO;
	}
	switch (compression) {
	case TiffConstants.COMPRESSION_NO:
		decoder = new RawCompression();
		break;
	case TiffConstants.COMPRESSION_CCITT_HUFFMAN:
		throw new TiffException("CCITT Huffman compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_T4:
		throw new TiffException("T4-encoding compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_T6:
		throw new TiffException("T6-encoding compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_LZW:
		decoder = new LZWCompression();
		break;
	case TiffConstants.COMPRESSION_JPEG_OLD:
	case TiffConstants.COMPRESSION_JPEG_NEW:
		throw new TiffException("JPEG compression not supported: "
				+ compression);
	case TiffConstants.COMPRESSION_DEFLATE:
	case TiffConstants.COMPRESSION_PKZIP_DEFLATE:
		decoder = new DeflateCompression();
		break;
	case TiffConstants.COMPRESSION_PACKBITS:
		decoder = new PackbitsCompression();
		break;
	default:
		throw new TiffException("Unknown compression method identifier: "
				+ compression);
	}
}
 
開發者ID:ngageoint,項目名稱:tiff-java,代碼行數:73,代碼來源:FileDirectory.java


注:本文中的mil.nga.tiff.util.TiffConstants.COMPRESSION_LZW屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。