Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,11 @@
class Entity implements Serializable {
static final serialVersionUID = 3504465751164822571L
String name = 'Thingamabob'
public String toString() { return name }
}
class Person extends Entity implements Serializable {
static final serialVersionUID = -9170445713373959735L
Person() { name = 'Clement' }
Person(name) { this.name = name }
}

View file

@ -0,0 +1,19 @@
File objectStore = new File('objectStore.ser')
if (objectStore.exists()) { objectStore.delete() }
assert ! objectStore.exists()
def os
try {
os = objectStore.newObjectOutputStream()
os << new Person()
os << 10.5
os << new Person('Cletus')
os << new Date()
os << new Person('Pious')
os << java.awt.Color.RED
os << new Person('Linus')
os << 'just random garbage'
os << new Person('Lucy')
os << ['lists', 'are', 'serializable']
os << new Person('Schroeder')
} catch (e) { throw new Exception(e) } finally { os?.close() }
assert objectStore.exists()

View file

@ -0,0 +1,8 @@
def is
try {
is = objectStore.newObjectInputStream(this.class.classLoader)
is.eachObject { println it }
} catch (e) { throw new Exception(e) } finally { is?.close() }
objectStore.delete()
assert ! objectStore.exists()