/** * Writes the specified index to the associated output stream. This may be called multiple times in order * to write multiple indexes. * * @param index the index to write to the stream * @param version the index file version * @return the number of bytes written to the stream * @throws IOException if any i/o error occurs */ public int write(Index index, int version) throws IOException { IndexWriterImpl writer = getWriter(version); if (writer == null) { throw new UnsupportedVersion("Version: " + version); } return writer.write(index, version); }