All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tangosol.io.pof.PrincipalPofSerializer Maven / Gradle / Ivy

There is a newer version: 24.09
Show newest version
/*
 * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
 *
 * Licensed under the Universal Permissive License v 1.0 as shown at
 * http://oss.oracle.com/licenses/upl.
 */

package com.tangosol.io.pof;


import java.io.IOException;

import java.security.Principal;


/**
* PofSerializer implementation that can serialize and deserialize a
* {@link Principal} to/from a POF stream.
* 

* The PrincipalPofSerializer can serialize any Principal implementation to a * POF stream; however, the Principals returned during deserialization are * always instances of the {@link PofPrincipal} class. * * @author jh 2008.08.12 */ public class PrincipalPofSerializer implements PofSerializer { // ----- constructors --------------------------------------------------- /** * Default constructor. */ public PrincipalPofSerializer() { } // ----- PofSerializer implementation ----------------------------------- /** * {@inheritDoc} */ public void serialize(PofWriter out, Object o) throws IOException { Principal principal = (Principal) o; out.writeString(0, principal.getName()); out.writeRemainder(null); } /** * {@inheritDoc} */ public Object deserialize(PofReader in) throws IOException { Object o = new PofPrincipal(in.readString(0)); in.registerIdentity(o); in.readRemainder(); return o; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy