This commit is contained in:
@@ -25,8 +25,8 @@ public class Z7Compressor extends Compressor<Z7Compressor> {
|
||||
* @param fromPath 源路径
|
||||
* @return 压缩器
|
||||
*/
|
||||
public static Z7Compressor of(String fromPath) {
|
||||
return new Z7Compressor().from(fromPath);
|
||||
public static Z7Compressor from(String fromPath) {
|
||||
return new Z7Compressor().of(fromPath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,15 +35,15 @@ public class Z7Compressor extends Compressor<Z7Compressor> {
|
||||
* @param fromFile 源文件
|
||||
* @return 压缩器
|
||||
*/
|
||||
public static Z7Compressor of(File fromFile) {
|
||||
return new Z7Compressor().from(fromFile);
|
||||
public static Z7Compressor from(File fromFile) {
|
||||
return new Z7Compressor().of(fromFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void toStream(String fromPath, OutputStream toStream) throws Exception {
|
||||
Path tempFile = Files.createTempFile("timi-compress-", ".7z");
|
||||
try {
|
||||
from(fromPath).toFile(tempFile.toFile());
|
||||
of(fromPath).toFile(tempFile.toFile());
|
||||
try (InputStream inputStream = Files.newInputStream(tempFile)) {
|
||||
transfer(inputStream, toStream, false);
|
||||
toStream.flush();
|
||||
|
||||
Reference in New Issue
Block a user