code: public byte getInternalByte(ColumnInformation columnInfo) throws SQLException {
      if (lastValueWasNull()) {
        return 0;
      }
      long value;
      switch (columnInfo.getColumnType()) {
        case BIT:
          value = parseBit();
          break;
        case TINYINT:
          value = getInternalTinyInt(columnInfo);
          break;
        case SMALLINT:
        case YEAR:
          value = getInternalSmallInt(columnInfo);
          break;
        case INTEGER:
        case MEDIUMINT:
          value = getInternalMediumInt(columnInfo);
          break;
        case BIGINT:
          value = getInternalLong(columnInfo);
          break;
        case FLOAT:
          value = (long) getInternalFloat(columnInfo);
          break;
        case DOUBLE:
          value = (long) getInternalDouble(columnInfo);
          break;
        case DECIMAL:
        case OLDDECIMAL:
          BigDecimal bigDecimal = getInternalBigDecimal(columnInfo);
          rangeCheck(Byte.class, Byte.MIN_VALUE, Byte.MAX_VALUE, bigDecimal, columnInfo);
          return bigDecimal.byteValue();
        case VARSTRING:
        case VARCHAR:
        case STRING:
          value = Long.parseLong(new String(buf, pos, length, StandardCharsets.UTF_8));
          break;
        default:
          throw new SQLException(
              "getByte not available for data field type " + columnInfo.getColumnType()
                  .getJavaTypeName());
      }
      rangeCheck(Byte.class, Byte.MIN_VALUE, Byte.MAX_VALUE, value, columnInfo);
      return (byte) value;
    }
docs: Get byte from raw binary format.
  
  @param columnInfo column information
  @return byte value
  @throws SQLException if column type doesn't permit conversion