public void process(Document document) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); VByteOutput output = new VByteOutput(new DataOutputStream(stream)); output.writeString(document.text); for (Map.Entry<String, String> entry : document.metadata.entrySet()) { output.writeString(entry.getKey()); output.writeString(entry.getValue()); } writer.add(new GenericElement(document.identifier, stream.toByteArray())); if (documentsWritten != null) documentsWritten.increment(); }
public void close() throws IOException { writer.close(); }