Compare commits
4 Commits
f9d6b26cdf
...
c0b4f41ea4
| Author | SHA1 | Date | |
|---|---|---|---|
| c0b4f41ea4 | |||
| 96ad0e2912 | |||
| f9d7221e0f | |||
| 3effab4def |
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ target/
|
|||||||
.idea/jarRepositories.xml
|
.idea/jarRepositories.xml
|
||||||
.idea/compiler.xml
|
.idea/compiler.xml
|
||||||
.idea/libraries/
|
.idea/libraries/
|
||||||
|
.idea/CopilotChatHistory.xml
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|||||||
57
pom.xml
57
pom.xml
@ -20,17 +20,60 @@
|
|||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>3.11.0</version>
|
<version>3.1.3</version>
|
||||||
<configuration>
|
</plugin>
|
||||||
<source>21</source>
|
<plugin>
|
||||||
<target>21</target>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<encoding>UTF-8</encoding>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
</configuration>
|
<version>3.3.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.11.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>timi_nexus</id>
|
||||||
|
<url>https://nexus.imyeyu.com/repository/maven-releases/</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>timi_nexus</id>
|
||||||
|
<url>https://nexus.imyeyu.com/repository/maven-public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.imyeyu.utils</groupId>
|
<groupId>com.imyeyu.utils</groupId>
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.imyeyu.utils.Text;
|
|||||||
import javax.naming.NoPermissionException;
|
import javax.naming.NoPermissionException;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -352,6 +353,19 @@ public class IO implements OS.FileSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] toStringLines(File file) throws IOException {
|
||||||
|
return toString(file).split("\r\n|[\r\n]");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void toStringLines(File file, CallbackArg<String> lineCallback) throws IOException {
|
||||||
|
try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
|
||||||
|
String line;
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
lineCallback.handler(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取文件为字符串(UTF-8)
|
* 读取文件为字符串(UTF-8)
|
||||||
*
|
*
|
||||||
@ -895,8 +909,13 @@ public class IO implements OS.FileSystem {
|
|||||||
* @param path jar 内文件路径,不需要 / 开始,如 config/TimiJava.ini
|
* @param path jar 内文件路径,不需要 / 开始,如 config/TimiJava.ini
|
||||||
* @return 数据流
|
* @return 数据流
|
||||||
*/
|
*/
|
||||||
public static boolean resourceExist(Class<?> clazz, String path) {
|
public static boolean resourceExist(Class<?> clazz, String path) throws IOException {
|
||||||
return resourceToInputStream(clazz, path) != null;
|
InputStream stream = resourceToInputStream(clazz, path);
|
||||||
|
if (stream != null) {
|
||||||
|
stream.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user