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


Java FileImageSource類代碼示例

本文整理匯總了Java中net.coobird.thumbnailator.tasks.io.FileImageSource的典型用法代碼示例。如果您正苦於以下問題:Java FileImageSource類的具體用法?Java FileImageSource怎麽用?Java FileImageSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: iterator

import net.coobird.thumbnailator.tasks.io.FileImageSource; //導入依賴的package包/類
public Iterator<ImageSource<File>> iterator()
{
	return new Iterator<ImageSource<File>>() {
		
		Iterator<String> iter = filenames.iterator();
		
		public boolean hasNext()
		{
			return iter.hasNext();
		}
		
		public ImageSource<File> next()
		{
			return new FileImageSource(iter.next());
		}
		
		public void remove()
		{
			throw new UnsupportedOperationException();
		}
	};
}
 
開發者ID:farhan,項目名稱:Android-Image-Resizer-Module,代碼行數:23,代碼來源:Thumbnails.java

示例2: task_ChangeOutputFormat_File_OutputStream

import net.coobird.thumbnailator.tasks.io.FileImageSource; //導入依賴的package包/類
@Test
public void task_ChangeOutputFormat_File_OutputStream() throws IOException
{
	// given
	ThumbnailParameter param =
		new ThumbnailParameterBuilder().size(50, 50).format("jpg").build();
	
	ByteArrayOutputStream os = new ByteArrayOutputStream();
	
	FileImageSource source = new FileImageSource("src/test/resources/Thumbnailator/grid.bmp");
	OutputStreamImageSink destination = new OutputStreamImageSink(os);
	
	// when
	Thumbnailator.createThumbnail(
			new SourceSinkThumbnailTask<File, OutputStream>(param, source, destination)
	);
	
	// then
	ByteArrayInputStream destIs = new ByteArrayInputStream(os.toByteArray());
	BufferedImage thumbnail = ImageIO.read(destIs);
	assertEquals(50, thumbnail.getWidth());
	assertEquals(50, thumbnail.getHeight());
	
	destIs = new ByteArrayInputStream(os.toByteArray());
	String formatName = TestUtils.getFormatName(destIs);
	assertEquals("JPEG", formatName);
}
 
開發者ID:coobird,項目名稱:thumbnailator,代碼行數:28,代碼來源:SourceSinkThumbnailTaskTest.java

示例3: FileThumbnailTask

import net.coobird.thumbnailator.tasks.io.FileImageSource; //導入依賴的package包/類
/**
 * Creates a {@link ThumbnailTask} in which image data is read from the
 * specified {@link File} and is output to a specified {@link File}, using
 * the parameters provided in the specified {@link ThumbnailParameter}.
 * 
 * @param param				The parameters to use to create the thumbnail.
 * @param sourceFile		The {@link File} from which image data is read.
 * @param destinationFile	The {@link File} to which thumbnail is written.
 * @throws NullPointerException		If the parameter is {@code null}.
 */
public FileThumbnailTask(ThumbnailParameter param, File sourceFile, File destinationFile)
{
	super(param);
	this.task = new SourceSinkThumbnailTask<File, File>(
			param,
			new FileImageSource(sourceFile),
			new FileImageSink(destinationFile)
	);
}
 
開發者ID:farhan,項目名稱:Android-Image-Resizer-Module,代碼行數:20,代碼來源:FileThumbnailTask.java


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