com.lone.common.core.swftools.StreamGobbler Maven / Gradle / Ivy
The newest version!
package com.lone.common.core.swftools;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class StreamGobbler extends Thread {
InputStream is;
String type;
public StreamGobbler(InputStream is, String type) {
this.is = is;
this.type = type;
}
public void run() {
try {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
if (type.equals("Error")) {
log.info("Error :" + line);
} else {
log.info("文件转换:" + line);
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}