public void write ( ObjectWriter out , ItemState itemState ) throws IOException { // write id out . writeInt ( SerializationConstants . ITEM_STATE ) ; out . writeInt ( itemState . getState ( ) ) ; out . writeBoolean ( itemState . isPersisted ( ) ) ; out . writeBoolean ( itemState . isEventFire ( ) ) ; if ( itemState . getOldPath ( ) == null ) { out . writeInt ( SerializationConstants . NULL_DATA ) ; } else { out . writeInt ( SerializationConstants . NOT_NULL_DATA ) ; byte [ ] buf = itemState . getOldPath ( ) . getAsString ( ) . getBytes ( Constants . DEFAULT_ENCODING ) ; out . writeInt ( buf . length ) ; out . write ( buf ) ; } // write flag isNodeData and ItemData ItemData data = itemState . getData ( ) ; boolean isNodeData = ( data instanceof PersistedNodeData ) ; out . writeBoolean ( isNodeData ) ; if ( isNodeData ) { PersistedNodeDataWriter wr = new PersistedNodeDataWriter ( ) ; wr . write ( out , ( PersistedNodeData ) data ) ; } else { PersistedPropertyDataWriter wr = new PersistedPropertyDataWriter ( ) ; wr . write ( out , ( PersistedPropertyData ) data ) ; } }
Write item state into file .