class="java"> public boolean addRef(Object object) throws IOException { int ref = _refs.get(object); if (ref >= 0) { writeRef(ref); return true; } else { _refs.put(object, _refs.size()); return false; } }