private void save ( OutputStream os , String id , SessionData data ) throws IOException { DataOutputStream out = new DataOutputStream ( os ) ; out . writeUTF ( id ) ; out . writeLong ( data . getCreationTime ( ) ) ; out . writeLong ( data . getAccessedTime ( ) ) ; out . writeLong ( data . getLastAccessedTime ( ) ) ; out . writeLong ( data . getExpiryTime ( ) ) ; out . writeLong ( data . getMaxInactiveInterval ( ) ) ; List < String > keys = new ArrayList <> ( data . getKeys ( ) ) ; out . writeInt ( keys . size ( ) ) ; ObjectOutputStream oos = new ObjectOutputStream ( out ) ; for ( String name : keys ) { oos . writeUTF ( name ) ; oos . writeObject ( data . getAttribute ( name ) ) ; } }
Save the session data .