当前位置: 首页>>代码示例>>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;未经允许,请勿转载。