code: @Override
      public void writeCompactLong(long value) throws IOException {
          if (value < COMPACT_LONG_MIN || value >= COMPACT_LONG_MAX) {
              throw new IllegalArgumentException("writeCompactLong can only serialize non-negative longs up to 2^62.");
          } else if (value > 0x3FFF_FFFF) {
              // All 8 bytes
              writeInt((int) (value >>> 32 | 0xC000_0000));
              writeInt((int) value);
          } else if (value > 0x3FFF) {
              // Only 4 bytes.
              writeInt((int) (value | 0x8000_0000));
          } else if (value > 0x3F) {
              // Only 2 bytes.
              writeShort((short) (value | 0x4000));
          } else {
              // 1 byte.
              writeByte((byte) value);
          }
      }
docs: {@inheritDoc}
  Encodes the given value as a compact long, using the following scheme (MSB=Most Significant Bits):
  * MSB = 00 for values in [0, 0x3F], with a 1-byte encoding.
  * MSB = 01 for values in (0x3F, 0x3FFF], with a 2-byte encoding (2 MSB are reserved, leaving 14 bits usable).
  * MSB = 10 for values in (0x3FFF, 0x3FFF_FFFF], with a 4-byte encoding (2 MSB are reserved, leaving 30 bits usable).
  * MSB = 11 for values in (0x3FFF_FFFF, 0x3FFF_FFFF_FFFF_FFFFL], with an 8-byte encoding (2 MSB are reserved, leaving 62 bits usable).
  
  @param value The value to encode.