本文整理汇总了Java中org.im4java.process.OutputConsumer类的典型用法代码示例。如果您正苦于以下问题:Java OutputConsumer类的具体用法?Java OutputConsumer怎么用?Java OutputConsumer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OutputConsumer类属于org.im4java.process包,在下文中一共展示了OutputConsumer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: showImageProperties
点赞 2
import org.im4java.process.OutputConsumer; //导入依赖的package包/类
/**
* Prints out on console a detailed report of the characteristics and format
* of the given image. Useful for debugging weird problematic images.
*
* @param imagePath
* The path to the image to analyze
*/
public void showImageProperties(String imagePath) {
IdentifyCmd identifyCmd = new IdentifyCmd();
IMOperation op = new IMOperation();
op.verbose();
identifyCmd.setOutputConsumer(new OutputConsumer() {
@Override
public void consumeOutput(InputStream inputStream)
throws IOException {
StringBuilder out = new StringBuilder();
final Reader in = new InputStreamReader(inputStream, "UTF-8");
char[] c = new char[1024];
int length = -1;
String result = "";
while ((length = in.read(c)) != -1) {
out.append(c, 0, length);
}
in.close();
result = out.toString();
System.err.println(result);
}
});
op.addImage(imagePath);
try {
identifyCmd.run(op);
} catch (Exception e2) {
// Do nothing
}
}
开发者ID:e-ucm,
项目名称:ead,
代码行数:39,
代码来源:ImgMagickUtils.java
示例2: setOutputConsumer
点赞 2
import org.im4java.process.OutputConsumer; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setOutputConsumer(@Nonnull OutputConsumer pOutputConsumer) {
super.setOutputConsumer(pOutputConsumer);
outputConsumer = pOutputConsumer;
}
开发者ID:sharneng,
项目名称:gm4java,
代码行数:9,
代码来源:GMBatchCommand.java