Start to add other data types

This commit is contained in:
Zontreck 2023-10-13 05:19:19 -07:00
parent cdc9b92d2d
commit e621cb9468
3 changed files with 72 additions and 9 deletions

View file

@ -0,0 +1,36 @@
package dev.zontreck.registry;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class VInt32 extends Entry {
public VInt32(String name, int value) {
super(EntryType.Int32, name);
Parent = null;
Value = value;
}
public int Value;
@Override
public void readValue(DataInputStream stream) throws IOException {
Value = stream.readInt();
}
@Override
public void Write(DataOutputStream stream) throws IOException {
super.Write(stream);
stream.writeInt(Value);
}
@Override
public String PrettyPrint(int indent) {
return super.PrettyPrint(indent) + " [" + Value + "]";
}
public VInt32 setInt32(int value) {
Value = value;
return this;
}
}

View file

@ -0,0 +1,36 @@
package dev.zontreck.registry;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class VInt64 extends Entry {
public VInt64(String name, long value) {
super(EntryType.Int64, name);
Parent = null;
Value = value;
}
public long Value;
@Override
public void readValue(DataInputStream stream) throws IOException {
Value = stream.readLong();
}
@Override
public void Write(DataOutputStream stream) throws IOException {
super.Write(stream);
stream.writeLong(Value);
}
@Override
public String PrettyPrint(int indent) {
return super.PrettyPrint(indent) + " [" + Value + "]";
}
public VInt64 setInt64(long value) {
Value = value;
return this;
}
}

View file

@ -29,15 +29,6 @@ public class Word extends Entry {
return super.PrettyPrint(indent) + " [" + Value + "]";
}
@Override
public void setValue(Object value) {
super.setValue(value);
if (value instanceof String str) {
Value = str;
}
}
public Word setWord(String value) {
Value = value;
return this;