public void writeIndex(String location) { System.out.println("Writing index at: " + location); ObjectOutputStream objectOutputStream = null; try { File outputFile = new File(location); if (!outputFile.exists()) { outputFile.getParentFile().mkdirs(); outputFile.createNewFile(); } OutputStream file = new FileOutputStream(outputFile); BufferedOutputStream buffer = new BufferedOutputStream(file); objectOutputStream = new ObjectOutputStream(buffer); objectOutputStream.writeObject(tokenCountMap); objectOutputStream.writeObject(references); } catch (IOException ex) { System.out.println( "\nError writing index for " + author.getName() + " at location " + location); } finally { if (objectOutputStream != null) try { objectOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } } }
public String getAuthorName() { return author.getName(); }