use of com.alibaba.otter.node.etl.common.io.compress.exception.CompressException in project otter by alibaba.
the class AbstractCompressor method compressTo.
public void compressTo(File input, File output) throws CompressException {
FileOutputStream outputStream = null;
FileInputStream inputStream = null;
try {
outputStream = new FileOutputStream(output);
inputStream = new FileInputStream(input);
this.compressTo(inputStream, outputStream);
} catch (FileNotFoundException e) {
throw new CompressException("File not found", e);
} finally {
IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream);
}
}
use of com.alibaba.otter.node.etl.common.io.compress.exception.CompressException in project otter by alibaba.
the class AbstractCompressor method decompress.
public InputStream decompress(File input) throws CompressException {
File temp = null;
InputStream result = null;
try {
temp = File.createTempFile("compress_", "jkt");
this.decompressTo(input, temp);
result = new FileInputStream(temp);
} catch (IOException e) {
throw new CompressException("Error while creating a temporary file", e);
}
return result;
}
use of com.alibaba.otter.node.etl.common.io.compress.exception.CompressException in project otter by alibaba.
the class AbstractCompressor method decompressTo.
public void decompressTo(File input, File output) throws CompressException {
FileInputStream inputStream = null;
FileOutputStream outputStream = null;
try {
outputStream = new FileOutputStream(output);
inputStream = new FileInputStream(input);
decompressTo(inputStream, outputStream);
} catch (FileNotFoundException e) {
throw new CompressException("File could not be found", e);
} finally {
IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream);
}
}
use of com.alibaba.otter.node.etl.common.io.compress.exception.CompressException in project otter by alibaba.
the class AbstractCompressor method decompress.
public InputStream decompress(InputStream input) throws CompressException {
File temp = null;
InputStream result = null;
FileOutputStream output = null;
try {
temp = File.createTempFile("compress_", "jkt");
output = new FileOutputStream(temp);
this.decompressTo(input, output);
result = new FileInputStream(temp);
} catch (IOException e) {
throw new CompressException("Error while creating a temporary file", e);
} finally {
IOUtils.closeQuietly(output);
}
return result;
}
Aggregations