public boolean writeUser ( User user ) { // save user info to file if ( resourcePath != null ) { lock . writeLock ( ) . lock ( ) ; try { File userDir = new File ( resourcePath , "users" ) ; if ( userDir . isDirectory ( ) ) { // get the file which corresponds to the user File userFile = new File ( userDir . getAbsolutePath ( ) , user . getName ( ) ) ; Properties props = user . toProperties ( ) ; try ( FileOutputStream out = new FileOutputStream ( userFile ) ) { props . store ( out , "" ) ; return true ; } catch ( IOException ex ) { log . error ( "Could not write users file" , ex ) ; } } } finally { lock . writeLock ( ) . unlock ( ) ; } } // end if resourcePath not null return false ; }
Writes the user to the disk