diff options
| author | Fuwn <[email protected]> | 2026-02-13 02:05:49 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-13 02:05:49 -0800 |
| commit | 9817c9b1647faaa1ffe4af5a7620a8602651f438 (patch) | |
| tree | ff22dd2e017565aadc146062f0c7064e74035df2 /NET/worlds/core/FastDataInput.java | |
| parent | fix: Decompilation artifact repairs for Java 11 compilation (diff) | |
| download | worldsplayer-9817c9b1647faaa1ffe4af5a7620a8602651f438.tar.xz worldsplayer-9817c9b1647faaa1ffe4af5a7620a8602651f438.zip | |
feat: Reimplement core I/O and system information native methods with pure Java
- FastDataInput: DataInputStream wrapper replacing native binary I/O
- DNSLookup: InetAddress.getAllByName() replacing native gethostbyname()
- Restorer: Array.newInstance() replacing native makeArray()
- SystemInfo: Runtime/File APIs for disk, memory, CPU, platform info
- StatMemNode: Runtime APIs for memory status reporting
Diffstat (limited to 'NET/worlds/core/FastDataInput.java')
| -rw-r--r-- | NET/worlds/core/FastDataInput.java | 80 |
1 files changed, 57 insertions, 23 deletions
diff --git a/NET/worlds/core/FastDataInput.java b/NET/worlds/core/FastDataInput.java index 75a71e7..ffdf882 100644 --- a/NET/worlds/core/FastDataInput.java +++ b/NET/worlds/core/FastDataInput.java @@ -1,70 +1,104 @@ package NET.worlds.core; import java.io.DataInput; +import java.io.DataInputStream; +import java.io.BufferedInputStream; +import java.io.FileInputStream; import java.io.IOException; public class FastDataInput implements DataInput { - private int nativeInfo; + private DataInputStream dataInputStream; public FastDataInput(String fileName) throws IOException { nativeInit(); - this.read(fileName); + + this.dataInputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(fileName))); } - public native void close(); + public void close() { + if (this.dataInputStream != null) { + try { + this.dataInputStream.close(); + } catch (IOException e) { + } + } + } @Override public void readFully(byte[] b) throws IOException { - this.readFully(b, 0, b.length); + this.dataInputStream.readFully(b); } - public static native void nativeInit(); + public static void nativeInit() { + } @Override - public native void readFully(byte[] var1, int var2, int var3) throws IOException; + public void readFully(byte[] var1, int var2, int var3) throws IOException { + this.dataInputStream.readFully(var1, var2, var3); + } @Override - public native int skipBytes(int var1) throws IOException; + public int skipBytes(int var1) throws IOException { + return this.dataInputStream.skipBytes(var1); + } @Override - public native boolean readBoolean() throws IOException; + public boolean readBoolean() throws IOException { + return this.dataInputStream.readBoolean(); + } @Override - public native byte readByte() throws IOException; + public byte readByte() throws IOException { + return this.dataInputStream.readByte(); + } @Override - public native int readUnsignedByte() throws IOException; + public int readUnsignedByte() throws IOException { + return this.dataInputStream.readUnsignedByte(); + } @Override - public native short readShort() throws IOException; + public short readShort() throws IOException { + return this.dataInputStream.readShort(); + } @Override - public native int readUnsignedShort() throws IOException; + public int readUnsignedShort() throws IOException { + return this.dataInputStream.readUnsignedShort(); + } @Override - public native char readChar() throws IOException; + public char readChar() throws IOException { + return this.dataInputStream.readChar(); + } @Override - public native int readInt() throws IOException; + public int readInt() throws IOException { + return this.dataInputStream.readInt(); + } @Override - public native long readLong() throws IOException; + public long readLong() throws IOException { + return this.dataInputStream.readLong(); + } @Override - public native float readFloat() throws IOException; + public float readFloat() throws IOException { + return this.dataInputStream.readFloat(); + } @Override - public native double readDouble() throws IOException; + public double readDouble() throws IOException { + return this.dataInputStream.readDouble(); + } @Override public String readLine() throws IOException { - assert false; - - return null; + return this.dataInputStream.readLine(); } @Override - public native String readUTF() throws IOException; - - private native void read(String var1) throws IOException; + public String readUTF() throws IOException { + return this.dataInputStream.readUTF(); + } } |