import java.io.*; public abstract class PersistentObject { protected int ID; final boolean DEBUG = false; public abstract void persist( DataOutputStream file ); public abstract void retrieve(DataInputStream file); protected void writeField( DataOutputStream file, String temp ) { for ( int i = 0; i < temp.length(); i++ ) { try { file.writeByte( temp.charAt(i) ); }catch(IOException e){} } try { file.writeByte( '°' ); }catch(IOException e){} } protected String readNextField( DataInputStream file) { byte ch = 0; String field = new String(""); try { while ((ch = file.readByte()) != (byte)('°') ) { if (DEBUG) System.out.println("read char: " + (char)ch ); field += (char)ch; } } catch( EOFException eof ) { return null; } catch( IOException e) {} if ( DEBUG ) System.out.println("read field: " + field ); return field; } public void setID( int i ) { ID = i; } public int getID() { return ID; } }