parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/SerializationUtil.java
@SuppressWarnings("unchecked")
  public static <T> T readObjectFromConfAsBase64(String key, Configuration conf) throws IOException {
    String b64 = conf.get(key);
    if (b64 == null) {
      return null;
    }

    byte[] bytes = Base64.decodeBase64(b64.getBytes(StandardCharsets.UTF_8));

    try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
           GZIPInputStream gis = new GZIPInputStream(bais);
           ObjectInputStream ois  = new ObjectInputStream(gis)) {
      return (T) ois.readObject();
    } catch (ClassNotFoundException e) {
      throw new IOException("Could not read object from config with key " + key, e);
    } catch (ClassCastException e) {
      throw new IOException("Couldn't cast object read from config with key " + key, e);
    }
  }
@SuppressWarnings("unchecked")
  public static <T> T readObjectFromConfAsBase64(String key, Configuration conf) throws IOException {
    String b64 = conf.get(key);
    if (b64 == null) {
      return null;
    }

    byte[] bytes = Base64.decodeBase64(b64.getBytes(StandardCharsets.UTF_8));

    try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
           GZIPInputStream gis = new GZIPInputStream(bais);
           ObjectInputStream ois  = new ObjectInputStream(gis)) {
      return (T) ois.readObject();
    } catch (ClassNotFoundException e) {
      throw new IOException("Could not read object from config with key " + key, e);
    } catch (ClassCastException e) {
      throw new IOException("Couldn't cast object read from config with key " + key, e);
    }
  }
@ SuppressWarnings ( "unchecked" ) public static < T > T readObjectFromConfAsBase64 ( String key , Configuration conf ) throws IOException { String b64 = conf . get ( key ) ; if ( b64 == null ) { return null ; } byte [ ] bytes = Base64 . decodeBase64 ( b64 . getBytes ( StandardCharsets . UTF_8 ) ) ; try ( ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; GZIPInputStream gis = new GZIPInputStream ( bais ) ; ObjectInputStream ois = new ObjectInputStream ( gis ) ) { return ( T ) ois . readObject ( ) ; } catch ( ClassNotFoundException e ) { throw new IOException ( "Could not read object from config with key " + key , e ) ; } catch ( ClassCastException e ) { throw new IOException ( "Couldn't cast object read from config with key " + key , e ) ; } }
Reads an object (that was written using
{@link #writeObjectToConfAsBase64}) from a configuration

@param key for the configuration
@param conf to read from
@param <T> the Java type of the deserialized object
@return the read object, or null if key is not present in conf
@throws IOException if there is an error while reading
Reads an object ( that was written using { @link #writeObjectToConfAsBase64 } ) from a configuration