Java Reference
In-Depth Information
private void load() {
try {
int v;
byte b[];
int length;
Location l;
DataInputStream dis;
locations.removeAllElements();
open();
dis = fc.openDataInputStream();
// Read version
v = dis.readInt();
// While there are more elements, read them.
while(true) {
length = dis.readInt();
b = new byte[length];
dis.read( b, 0, length);
l = new Location(b);
locations.addElement( l );
}
}
catch(Exception ex) {};
close();
}
private void save() {
try {
int i;
byte[] b;
DataOutputStream dos;
open();
dos = fc.openDataOutputStream();
// Write version
dos.writeInt( 1 );
 
Search WWH ::




Custom Search