Exemple #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);
 }
Exemple #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);
 }
Exemple #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;
            }
          }
        });
  }
Exemple #4
0
 @Override
 public void close() throws IOException {
   wal.close();
 }
Exemple #5
0
 @Override
 public void flush() throws IOException {
   wal.flush();
 }
Exemple #6
0
 @Override
 public void write(Message line) throws IOException {
   wal.write(MessageUtil.toBase64(line));
 }