public static void main(@NotNull String... args) throws IOException, InterruptedException {
    if (args.length < 1) {
      System.err.println(
          "Usage: java " + ChronicleReader.class.getName() + " {chronicle-base-path} [from-index]");
      System.exit(-1);
    }

    String basePath = args[0];
    long index = args.length > 1 ? Long.parseLong(args[1]) : 0L;
    IndexedChronicle ic = new IndexedChronicle(basePath);
    ExcerptTailer excerpt = ic.createTailer();
    //noinspection InfiniteLoopStatement
    while (true) {
      while (!excerpt.nextIndex())
        //noinspection BusyWait
        Thread.sleep(50);
      System.out.print(index + ": ");
      int nullCount = 0;
      while (excerpt.remaining() > 0) {
        char ch = (char) excerpt.readUnsignedByte();
        if (ch == 0) {
          nullCount++;
          continue;
        }
        if (nullCount > 0) System.out.print(" " + nullCount + "*\\0");
        nullCount = 0;
        if (ch < ' ') System.out.print("^" + (char) (ch + '@'));
        else if (ch > 126) System.out.print("\\x" + Integer.toHexString(ch));
        else System.out.print(ch);
      }
      if (nullCount > 0) System.out.print(" " + nullCount + "*\\0");
      System.out.println();
      index++;
    }
  }