⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imagewriter.java

📁 Python Development Environment (Python IDE plugin for Eclipse). Features editor, code completion, re
💻 JAVA
字号:
package ch.hsr.ukistler.astgraph;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;

import javax.imageio.ImageIO;

public class ImageWriter implements Runnable {

	private BufferedImage img;

	private String fileName;

	public ImageWriter(BufferedImage img, String fileName) throws Throwable {
		if (img == null)
			throw new Exception("Image cannot be retrieved");
		this.img = img;
		this.fileName = fileName;
	}

	public void run() {
		FileOutputStream out;
		try {
			out = new FileOutputStream(new File(fileName));
			ImageIO.write(img, "png", out);
			out.flush();
			out.close();
		} catch (Throwable e) {

		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -