public static byte [ ] serializeToken ( final Token < AMRMTokenIdentifier > token ) { try ( final DataOutputBuffer dob = new DataOutputBuffer ( ) ) { final Credentials credentials = new Credentials ( ) ; credentials . addToken ( token . getService ( ) , token ) ; credentials . writeTokenStorageToStream ( dob ) ; return dob . getData ( ) ; } catch ( final IOException ex ) { LOG . log ( Level . SEVERE , "Could not write credentials to the buffer." , ex ) ; throw new RuntimeException ( ex ) ; } }
Helper method to serialize a security token .