Exemplo n.º 1
0
 @Override
 public void write(Message[] msgLines, int from, int max) throws IOException {
   String[] lines = new String[max];
   for (int i = from; i < max; i++) {
     lines[i] = MessageUtil.toBase64(msgLines[i]);
   }
   wal.write(lines);
 }
Exemplo n.º 2
0
 @Override
 public void write(WeakReference<? extends Message>[] msgLines, int from, int max)
     throws IOException {
   String[] lines = new String[max];
   for (int i = from; i < max; i++) {
     lines[i] = MessageUtil.toBase64(msgLines[i].get());
   }
   wal.write(lines);
 }
Exemplo n.º 3
0
  @Override
  public int eachLineFrom(
      int linePos, final Message.Builder builder, final EachClosure<Message> closure)
      throws IOException {

    return wal.eachLineFrom(
        linePos,
        new EachClosure<String>() {

          @Override
          public void call(String t, int index) {
            try {
              Message protoValue = builder.clone().mergeFrom(MessageUtil.fromBase64(t)).build();
              closure.call(protoValue, index);
            } catch (Throwable e) {
              RuntimeException rte = new RuntimeException(e);
              rte.setStackTrace(e.getStackTrace());
              throw rte;
            }
          }
        });
  }
Exemplo n.º 4
0
 @Override
 public void close() throws IOException {
   wal.close();
 }
Exemplo n.º 5
0
 @Override
 public void flush() throws IOException {
   wal.flush();
 }
Exemplo n.º 6
0
 @Override
 public void write(Message line) throws IOException {
   wal.write(MessageUtil.toBase64(line));
 }