/** * This is the place where we serialize Dn * * @param dn The Dn to serialize * @return The byte[] containing the serialized Dn */ public byte[] serialize( Dn dn ) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream( baos ); // First, the Dn dn.writeExternal( out ); out.flush(); if ( IS_DEBUG ) { LOG.debug( ">------------------------------------------------" ); LOG.debug( "Serialized " + dn ); } return baos.toByteArray(); } catch ( IOException e ) { throw new RuntimeException( e ); } }
/** * This is the place where we serialize Dn * * @param object The element to serialize * @return a byte[] containing the serialized element * @throws IOException If teh serialization failed */ public byte[] serialize( Object object ) throws IOException { Dn dn = ( Dn ) object; try ( ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream( baos ) ) { // First, the Dn dn.writeExternal( out ); out.flush(); if ( IS_DEBUG ) { LOG.debug( ">------------------------------------------------" ); LOG.debug( "Serialized " + dn ); } return baos.toByteArray(); } }
Dn.EMPTY_DN.writeExternal( out ); dn.writeExternal( out );
Dn.EMPTY_DN.writeExternal( out ); dn.writeExternal( out );
Dn.EMPTY_DN.writeExternal( out ); dn.writeExternal( out );
/** * Serializes a LdapPrincipal instance. * * @param principal The LdapPrincipal instance to serialize * @param out The stream into which we will write the serialized instance * @throws IOException If the stream can't be written */ public static void serialize( LdapPrincipal principal, ObjectOutput out ) throws IOException { // The Authentication level out.writeInt( principal.getAuthenticationLevel().getLevel() ); // The principal's DN if ( principal.getDn() == null ) { Dn.EMPTY_DN.writeExternal( out ); } else { principal.getDn().writeExternal( out ); } }
entryDn.writeExternal( out ); break; entryDn.writeExternal( out ); entryDn.writeExternal( out );
entryDn.writeExternal( out ); break; entryDn.writeExternal( out ); entryDn.writeExternal( out );
entryDn.writeExternal( out ); break; entryDn.writeExternal( out ); entryDn.writeExternal( out );
/** * {@inheritDoc} */ public byte[] serialize( Object object ) throws IOException { ReplicaEventMessage replicaEventMessage = ( ReplicaEventMessage ) object; Entry entry = replicaEventMessage.getEntry(); ChangeType changeType = replicaEventMessage.getChangeType(); try ( ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream( baos ) ) { // The change type first out.writeByte( changeType.getValue() ); // The entry DN entry.getDn().writeExternal( out ); // The entry entry.writeExternal( out ); out.flush(); return baos.toByteArray(); } }