update to v1.1.1 优化了文件功能的兼容性

This commit is contained in:
kohgylw 2023-03-03 10:59:24 +08:00
parent 27cb140e19
commit 8b2e8f5dc0
180 changed files with 13 additions and 13 deletions

View File

@ -72,5 +72,5 @@ _提示源代码路径下包含了一些程序运行所需的非源代码资
### 联系作者?
如有任何需要(例如对该资源有疑问、意见或建议),请发件联系作者: kohgylw@163.com (青阳龙野),随时恭候您的来信!
青阳龙野@kohgylw by 2022年09月02
青阳龙野@kohgylw by 2023年03月03

View File

@ -198,3 +198,4 @@ test.auth.xxx=ucd
--------------
【已完成】优化了“文件搜索”功能,现在关键字不再区分大小写了。
【已完成】优化了文件列表的文件体积显示新增了GB和TB显示单位。
【已完成】解决“文件”功能中FileSystemManager.transferFile(:935)的Java 8兼容性问题。

View File

@ -1,5 +1,7 @@
package kohgylw.kiftd.util.file_system_manager;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -429,7 +431,7 @@ public class FileSystemManager {
Node node = nodes.parallelStream().filter((e) -> e.getFileName().equals(f.getName())).findFirst()
.get();// 得到重名节点删除它
deleteFile(node.getFileId());
if(selectNodeById(node.getFileId()) != null) {
if (selectNodeById(node.getFileId()) != null) {
// 测试是否删除成功
throw new IOException();
}
@ -924,24 +926,21 @@ public class FileSystemManager {
private void transferFile(File f, File target) throws Exception {
long size = f.length();
FileOutputStream fileOutputStream = new FileOutputStream(target);
FileInputStream fileInputStream = new FileInputStream(f);
FileChannel out = fileOutputStream.getChannel();
FileChannel in = fileInputStream.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
FileOutputStream fileOutputStream = new FileOutputStream(target);
BufferedInputStream in = new BufferedInputStream(fileInputStream);
BufferedOutputStream out = new BufferedOutputStream(fileOutputStream);
byte[] buffer = new byte[BUFFER_SIZE];
int length = 0;
long finishLength = 0;
while ((length = in.read(buffer)) != -1 && gono) {
buffer.flip();
out.write(buffer);
buffer.clear();
out.write(buffer, 0, length);
finishLength += length;
per = (int) (((double) finishLength / (double) size) * 100);
}
in.close();
out.flush();
out.close();
fileInputStream.close();
fileOutputStream.close();
return;
}

View File

@ -1 +1 @@
/kohgylw/
/META-INF/

View File

@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
#Sun Oct 02 09:16:39 CST 2022
#Fri Mar 03 10:32:33 CST 2023
m2e.projectLocation=/Users/kohgylw/Programs/java_workspace/kiftd-source
m2e.projectName=kiftd-source
groupId=kohgylw

Some files were not shown because too many files have changed in this diff Show More