code: public static void writeRawVarint32(OutputStream os, int value) throws IOException {
          while (true) {
              if ((value & ~0x7F) == 0) {
                  os.write(value);
                  return;
              } else {
                  os.write((value & 0x7F) | 0x80);
                  value >>>= 7;
              }
          }
      }
docs: Encode and write a varint.  {@code value} is treated as unsigned, so it won't be sign-extended if negative.
  
  <p>Copied from com.google.protobuf.CodedOutputStream from Google's protobuf library.</p>