Java Code Examples for org.apache.commons.io.FileUtils.getTempDirectoryPath()

The following are Jave code examples for showing how to use getTempDirectoryPath() of the org.apache.commons.io.FileUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: dcits-report   File: Tess4jUtil.java   View Source Code Vote up 5 votes
public static String recognize(InputStream is) {
	try {
		String filePath = FileUtils.getTempDirectoryPath() + File.separatorChar + "ocrtmp.jpg";
		File tmpFile = new File(filePath);
		FileUtils.copyInputStreamToFile(is, tmpFile);

		// 识别验证码图片(去掉返回结果的换行符和空格)
		String ocrCode = instance.doOCR(tmpFile).replaceAll("\n", "").replaceAll(" ", "");
		logger.info("验证码图片识别结果:" + ocrCode);
		return ocrCode;
	} catch (Exception e) {
		logger.error("验证码图片识别异常:", e);
	}
	return "";
}