6.0.1 - Alpha - 增加全局Polyfill及扩展对象

This commit is contained in:
SuperMonster003
2021-12-05 10:40:13 +08:00
parent 99a1d8490f
commit 98cf339cce
34 changed files with 664 additions and 941 deletions

View File

@@ -23,21 +23,19 @@ import java.util.Objects;
* Created by Stardust on 2017/4/1.
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
public class PFiles {
static final int DEFAULT_BUFFER_SIZE = 8192;
static final String DEFAULT_ENCODING = Charset.defaultCharset().name();
public static PFileInterface open(String path, String mode, String encoding, int bufferSize) {
switch (mode) {
case "r":
return new PReadableTextFile(path, encoding, bufferSize);
case "w":
return new PWritableTextFile(path, encoding, bufferSize, false);
case "a":
return new PWritableTextFile(path, encoding, bufferSize, true);
}
return null;
return switch (mode) {
case "r" -> new PReadableTextFile(path, encoding, bufferSize);
case "w" -> new PWritableTextFile(path, encoding, bufferSize, false);
case "a" -> new PWritableTextFile(path, encoding, bufferSize, true);
default -> null;
};
}
public static Object open(String path, String mode, String encoding) {