question: private void saveToFile ( boolean onlyName ) { FollowerInfo info = lastValidInfo ; if ( info != null ) { Path path = Paths . get ( Chatty . getUserDataDirectory ( ) , "exported" ) ; Path file = path . resolve ( StringUtil . toLowerCase ( type . toString ( ) ) + ".txt" ) ; try { Files . createDirectories ( path ) ; try ( BufferedWriter writer = Files . newBufferedWriter ( file , Charset . forName ( "UTF-8" ) ) ) { for ( Follower f : lastValidInfo . followers ) { writer . write ( f . name ) ; if ( ! onlyName ) { writer . write ( "\t" + DateTime . formatFullDatetime ( f . time ) ) ; writer . write ( " (" + DateTime . agoSingleVerbose ( f . time ) + ")" ) ; } writer . newLine ( ) ; } } } catch ( IOException ex ) { JOptionPane . showMessageDialog ( this , ex , "Failed to write file." , JOptionPane . ERROR_MESSAGE ) ; return ; } JOptionPane . showMessageDialog ( this , type + " exported to: " + file , "File written." , JOptionPane . INFORMATION_MESSAGE ) ; } else { JOptionPane . showMessageDialog ( this , "No data to write." , "Failed to write file." , JOptionPane . ERROR_MESSAGE ) ; } }
target:  Save last valid FollowerInfo entries to file.