use of lzma.streams.LzmaOutputStream in project SKMCLauncher by SKCraft.
the class UpdateBuilder method copyFileLzma.
@SuppressWarnings("unused")
private static void copyFileLzma(File sourceFile, File destFile) throws IOException {
destFile.getParentFile().mkdirs();
FileInputStream fis = null;
BufferedInputStream bis = null;
FileOutputStream fos = null;
BufferedOutputStream bos = null;
LzmaOutputStream compress = null;
try {
fis = new FileInputStream(sourceFile);
bis = new BufferedInputStream(fis);
fos = new FileOutputStream(destFile);
bos = new BufferedOutputStream(fos);
compress = new LzmaOutputStream(bos, new Encoder());
byte[] buffer = new byte[1024 * 8];
int length;
while ((length = bis.read(buffer)) > 0) {
compress.write(buffer, 0, length);
}
} finally {
LauncherUtils.close(bis);
LauncherUtils.close(fis);
LauncherUtils.close(compress);
LauncherUtils.close(bos);
LauncherUtils.close(fos);
}
}
Aggregations