protected void writeMemo ( Object obj ) throws IOException { if ( ! this . useMemo ) return ; int hash = valueCompare ? obj . hashCode ( ) : System . identityHashCode ( obj ) ; if ( ! memo . containsKey ( hash ) ) { int memo_index = memo . size ( ) ; memo . put ( hash , new Memo ( obj , memo_index ) ) ; if ( memo_index <= 0xFF ) { out . write ( Opcodes . BINPUT ) ; out . write ( ( byte ) memo_index ) ; } else { out . write ( Opcodes . LONG_BINPUT ) ; byte [ ] index_bytes = PickleUtils . integer_to_bytes ( memo_index ) ; out . write ( index_bytes , 0 , 4 ) ; } } }
Write the object to the memo table and output a memo write opcode Only works for hashable objects