Ejemplo n.º 1
0
  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();
  }
Ejemplo n.º 2
0
 public void close() throws IOException {
   writer.close();
 }