4 Commits
Author SHA1 Message Date
timi 319705c2fc Merge pull request 'v0.0.5' (#4) from dev into master
Reviewed-on: #4
2026-05-07 06:46:06 +00:00
timi fb86228d03 Merge pull request 'v0.0.4' (#3) from dev into master
Reviewed-on: #3
2026-05-06 08:49:51 +00:00
timi 5c5dabeb05 Merge pull request 'v0.0.3' (#2) from dev into master
Reviewed-on: #2
2026-03-21 10:15:20 +00:00
timi 829790af29 Merge pull request 'v0.0.2' (#1) from dev into master
Reviewed-on: #1
2026-01-19 09:46:56 +00:00
2 changed files with 6 additions and 21 deletions
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>com.imyeyu.io</groupId>
<artifactId>timi-io</artifactId>
<version>0.1.1</version>
<version>0.0.5</version>
<packaging>jar</packaging>
<properties>
@@ -92,7 +92,7 @@
<dependency>
<groupId>com.imyeyu.utils</groupId>
<artifactId>timi-utils</artifactId>
<version>0.1.1</version>
<version>0.0.5</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
+4 -19
View File
@@ -1,10 +1,9 @@
package com.imyeyu.io;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.ActionException;
import com.imyeyu.java.bean.Callback;
import com.imyeyu.java.bean.CallbackArg;
import com.imyeyu.java.bean.ResultCode;
import com.imyeyu.java.bean.timi.TimiCode;
import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.utils.Decoder;
import com.imyeyu.utils.OS;
import com.imyeyu.utils.Text;
@@ -135,20 +134,6 @@ public class IO implements OS.FileSystem {
return dir;
}
public static File dir(String path, File def) {
if (TimiJava.isEmpty(path)) {
return def;
}
File dir = new File(path);
if (dir.exists()) {
if (dir.isFile()) {
return dir.getParentFile();
}
return dir;
}
return def;
}
/**
* 获取文件对象,如果不存在则创建该文件
*
@@ -233,7 +218,7 @@ public class IO implements OS.FileSystem {
if (file.renameTo(resultFile) && resultFile.exists()) {
return resultFile;
}
throw new ActionException(ResultCode.RESULT_BAD, "rename file fail: from " + file.getAbsolutePath() + ", to " + resultFile.getAbsolutePath());
throw new TimiException(TimiCode.RESULT_BAD, "rename file fail: from " + file.getAbsolutePath() + ", to " + resultFile.getAbsolutePath());
} else {
String msg = "Illeagl file name: %s, not allow char: %s";
if (OS.IS_WINDOWS) {
@@ -661,7 +646,7 @@ public class IO implements OS.FileSystem {
public static void toOutputStream(InputStream is, OutputStream os, long start, long end) throws IOException {
long skip = is.skip(start);
if (skip != start) {
throw new ActionException(ResultCode.ERROR, "skip fail");
throw new TimiException(TimiCode.ERROR, "skip fail");
}
byte[] buffer = new byte[8192];
long remaining = end - start + 1;