code: public int readVarInt32() throws IOException {
          byte tmp = readByte();
          if (tmp >= 0) {
              return tmp;
          }
          int result = tmp & 0x7f;
          if ((tmp = readByte()) >= 0) {
              result |= tmp << 7;
          } else {
              result |= (tmp & 0x7f) << 7;
              if ((tmp = readByte()) >= 0) {
                  result |= tmp << 14;
              } else {
                  result |= (tmp & 0x7f) << 14;
                  if ((tmp = readByte()) >= 0) {
                      result |= tmp << 21;
                  } else {
                      result |= (tmp & 0x7f) << 21;
                      result |= (tmp = readByte()) << 28;
                      if (tmp < 0) {
                          throw new IOException("malformed varint detected");
                      }
                  }
              }
          }
          return result;
      }
docs: reads a variable int32 from the current position
  
  @return the int
  @throws IOException if the data cannot be read, or is not a valid variable int32