Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,50 @@
bundle Default {
class Thingy {
@id : Int;
New(id : Int) {
@id := id;
}
method : public : Print() ~ Nil {
@id->PrintLine();
}
}
class Person from Thingy {
@name : String;
New(id : Int, name : String) {
Parent(id);
@name := name;
}
method : public : Print() ~ Nil {
@id->PrintLine();
@name->PrintLine();
}
}
class Serial {
function : Main(args : String[]) ~ Nil {
t := Thingy->New(7);
p := Person->New(13, "Bush");
s := IO.Serializer->New();
s->Write(t->As(Base));
s->Write(p->As(Base));
writer := IO.FileWriter->New("objects.dat");
writer->WriteBuffer(s->Serialize());
writer->Close();
buffer := IO.FileReader->ReadBinaryFile("objects.dat");
d := IO.Deserializer->New(buffer);
t2 := d->ReadObject()->As(Thingy);
t2->Print();
p2 := d->ReadObject()->As(Person);
p2->Print();
}
}
}