/// <summary> /// Convenience method for reading a token storage file, and loading the Tokens /// therein in the passed UGI /// </summary> /// <param name="filename"/> /// <param name="conf"/> /// <exception cref="System.IO.IOException"/> public static Org.Apache.Hadoop.Security.Credentials ReadTokenStorageFile(FilePath filename, Configuration conf) { DataInputStream @in = null; Org.Apache.Hadoop.Security.Credentials credentials = new Org.Apache.Hadoop.Security.Credentials (); try { @in = new DataInputStream(new BufferedInputStream(new FileInputStream(filename))); credentials.ReadTokenStorageStream(@in); return(credentials); } catch (IOException ioe) { throw new IOException("Exception reading " + filename, ioe); } finally { IOUtils.Cleanup(Log, @in); } }
/// <summary> /// Convenience method for reading a token storage file, and loading the Tokens /// therein in the passed UGI /// </summary> /// <param name="filename"/> /// <param name="conf"/> /// <exception cref="System.IO.IOException"/> public static Org.Apache.Hadoop.Security.Credentials ReadTokenStorageFile(Path filename , Configuration conf) { FSDataInputStream @in = null; Org.Apache.Hadoop.Security.Credentials credentials = new Org.Apache.Hadoop.Security.Credentials (); try { @in = filename.GetFileSystem(conf).Open(filename); credentials.ReadTokenStorageStream(@in); @in.Close(); return(credentials); } catch (IOException ioe) { throw new IOException("Exception reading " + filename, ioe); } finally { IOUtils.Cleanup(Log, @in); } }