@SuppressWarnings("UnusedException")
  private byte[] readPref() throws IOException {
    try {
      String keysetHex = sharedPreferences.getString(keysetName, null /* default value */);
      if (keysetHex == null) {
        throw new FileNotFoundException(
            String.format("can't read keyset; the pref value %s does not exist", keysetName));
      }
      return Hex.decode(keysetHex);
    } catch (ClassCastException | IllegalArgumentException ex) {
      // The original exception is swallowed to prevent leaked key material.
      throw new CharConversionException(
          String.format(
              "can't read keyset; the pref value %s is not a valid hex string", keysetName));
    }
  }
Creates a {@link KeysetReader} that reads and hex-decodes keysets from the preference
name {@code keysetName} in the private shared preferences file {@code prefFilename}.

<p>If {@code prefFilename} is null, uses the default shared preferences file.

@throws IOException if cannot read the keyset
@throws IllegalArgumentException if {@code keysetName} is null
java_src/src/main/java/com/google/crypto/tink/integration/android/SharedPrefKeysetReader.java