Marker instruction rework

This commit is contained in:
Anuken
2023-09-28 01:04:03 -04:00
parent 68a5ab14be
commit 8bbf5b1f52
18 changed files with 202 additions and 89 deletions

View File

@@ -44,6 +44,15 @@ public class JsonIO{
}
};
public static void writeBytes(Object value, Class<?> elementType, DataOutputStream output){
json.setWriter(new UBJsonWriter(output));
json.writeValue(value, value == null ? null : value.getClass(), elementType);
}
public static <T> T readBytes(Class<T> type, Class<?> elementType, DataInputStream input) throws IOException{
return json.readValue(type, elementType, new UBJsonReader().parseWihoutClosing(input));
}
public static String write(Object object){
return json.toJson(object, object.getClass());
}