HadoopUtils { @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(Charsets.UTF_8)); ByteArrayInputStream bais = null; GZIPInputStream gis = null; ObjectInputStream ois = null; try { bais = new ByteArrayInputStream(bytes); gis = new GZIPInputStream(bais); ois = new ObjectInputStream(gis); return (T) ois.readObject(); } catch (ClassNotFoundException e) { LOG.error("Could not read object from config with key " + key, e); throw new IOException(e); } catch (ClassCastException e) { LOG.error("Couldn't cast object read from config with key " + key, e); throw new IOException(e); } finally { Closeables.close(ois, false); Closeables.close(gis, false); Closeables.close(bais, false); } } private  HadoopUtils(); static Counter getCounter(JobContext ctx, String group, String counter); @Deprecated static void setInputFormatClass(Configuration  conf,
                                         String         configKey,
                                         Class<?>       clazz); static void setClassConf(Configuration  conf,
                                  String         configKey,
                                  Class<?>       clazz); static void writeObjectToConfAsBase64(String key, Object obj, Configuration conf); @SuppressWarnings("unchecked") static T readObjectFromConfAsBase64(String key, Configuration conf); static void writeStringListToConfAsJson(String key,
                                                 List<String> list,
                                                 Configuration conf); @SuppressWarnings("unchecked") static List<String> readStringListFromConfAsJson(String key, Configuration conf); static void writeStringListToConfAsBase64(String key, List<String> list, Configuration
    conf); @SuppressWarnings("unchecked") static List<String> readStringListFromConfAsBase64(String key, Configuration conf);  }
@Test public void readObjectFromConfAsBase64UnsetKey() throws Exception { assertNull(HadoopUtils.readObjectFromConfAsBase64("non-existant-key", new Configuration())); }