@Nullable
public final static Object deserialize(final ClassInfo<?> type, InputStream value) {
Serializer<?> s;
assert (s = type.getSerializer()) != null && (s.mustSyncDeserialization() ? Bukkit.isPrimaryThread() : true);
YggdrasilInputStream in = null;
try {
value = new SequenceInputStream(new ByteArrayInputStream(getYggdrasilStart(type)), value);
in = Variables.yggdrasil.newInputStream(value);
return in.readObject();
} catch (final IOException e) { // i.e. invalid save
if (Skript.testing())
e.printStackTrace();
return null;
} finally {
if (in != null) {
try {
in.close();
} catch (final IOException e) {}
}
try {
value.close();
} catch (final IOException e) {}