public ByteBuffer encode() throws EncoderException { ByteBuffer bb = ByteBuffer.allocate( computeLength() ); bb.put( UniversalTag.SEQUENCE_TAG ); bb.put( Value.getBytes( requestLength ) ); Value.encode( bb, targetDN ); Value.encode( bb, issuerDN ); Value.encode( bb, subjectDN ); Value.encode( bb, keyAlgorithm ); return bb; }
public ByteBuffer encode() throws EncoderException { ByteBuffer bb = ByteBuffer.allocate( computeLength() ); bb.put( UniversalTag.SEQUENCE.getValue() ); bb.put( Value.getBytes( requestLength ) ); Value.encode( bb, targetDN ); Value.encode( bb, issuerDN ); Value.encode( bb, subjectDN ); Value.encode( bb, keyAlgorithm ); return bb; }
/** * {@inheritDoc} */ public byte[] getValue() { if ( value == null ) { try { computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE_TAG ); buffer.put( TLV.getBytes( psearchSeqLength ) ); Value.encode( buffer, changeTypes ); Value.encode( buffer, changesOnly ); Value.encode( buffer, returnECs ); value = buffer.array(); } catch ( Exception e ) { return null; } } return value; }
/** * {@inheritDoc} */ public byte[] getValue() { if ( value == null ) { try { computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE_TAG ); buffer.put( TLV.getBytes( pscSeqLength ) ); Value.encode( buffer, size ); Value.encode( buffer, cookie ); value = buffer.array(); } catch ( Exception e ) { return null; } } return value; }
/** * {@inheritDoc} */ public byte[] getValue() { if ( value == null ) { try { computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); // Now encode the Subentries specific part Value.encode( buffer, visibility ); value = buffer.array(); } catch ( Exception e ) { return null; } } return value; }
/** * Encodes the cancel extended operation. * * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode() throws EncoderException { // Allocate the bytes buffer. ByteBuffer bb = ByteBuffer.allocate( computeLength() ); // The sequence bb.put( UniversalTag.SEQUENCE_TAG ); bb.put( TLV.getBytes( cancelSequenceLength ) ); // The messageId Value.encode( bb, cancelId ); return bb; }
/** * Encodes the persistent search control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Encode the Control envelop super.encode( buffer ); // Encode the OCTET_STRING tag buffer.put( UniversalTag.OCTET_STRING_TAG ); buffer.put( TLV.getBytes( valueLength ) ); // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE_TAG ); buffer.put( TLV.getBytes( psearchSeqLength ) ); Value.encode( buffer, changeTypes ); Value.encode( buffer, changesOnly ); Value.encode( buffer, returnECs ); return buffer; }
/** * Encodes the cancel extended operation. * * @return A ByteBuffer that contains the encoded PDU * @throws org.apache.directory.shared.asn1.EncoderException If anything goes wrong. */ public ByteBuffer encode() throws EncoderException { // Allocate the bytes buffer. ByteBuffer bb = ByteBuffer.allocate( computeLength() ); // The sequence bb.put( UniversalTag.SEQUENCE.getValue() ); bb.put( TLV.getBytes( cancelSequenceLength ) ); // The messageId Value.encode( bb, cancelId ); return bb; }
/** * {@inheritDoc} */ public byte[] getValue() { if ( value == null ) { try { computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); // Now encode the Subentries specific part Value.encode( buffer, isVisible() ); value = buffer.array(); } catch ( Exception e ) { return null; } } return value; }
/** * {@inheritDoc} */ public byte[] getValue() { if ( value == null ) { try { computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( psearchSeqLength ) ); Value.encode( buffer, getChangeTypes() ); Value.encode( buffer, isChangesOnly() ); Value.encode( buffer, isReturnECs() ); value = buffer.array(); } catch ( Exception e ) { return null; } } return value; }
/** * Encodes the gracefulShutdown extended operation. * * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode() throws EncoderException { // Allocate the bytes buffer. ByteBuffer bb = ByteBuffer.allocate( computeLength() ); bb.put( UniversalTag.SEQUENCE_TAG ); bb.put( TLV.getBytes( gracefulSequenceLength ) ); if ( timeOffline != 0 ) { Value.encode( bb, timeOffline ); } if ( delay != 0 ) { bb.put( ( byte ) GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG ); bb.put( ( byte ) Value.getNbBytes( delay ) ); bb.put( Value.getBytes( delay ) ); } return bb; }
/** * Encode the Referral message to a PDU. * * @param buffer The buffer where to put the PDU * @return The PDU. */ public static void encodeReferral( ByteBuffer buffer, Referral referral ) throws EncoderException { Collection<byte[]> ldapUrlsBytes = referral.getLdapUrlsBytes(); if ( ( ldapUrlsBytes != null ) && ( ldapUrlsBytes.size() != 0 ) ) { // Encode the referrals sequence // The referrals length MUST have been computed before ! buffer.put( ( byte ) LdapConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG ); buffer.put( TLV.getBytes( referral.getReferralLength() ) ); // Each referral for ( byte[] ldapUrlBytes : ldapUrlsBytes ) { // Encode the current referral Value.encode( buffer, ldapUrlBytes ); } } }
/** * Encodes the persistent search control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( psearchSeqLength ) ); Value.encode( buffer, getChangeTypes() ); Value.encode( buffer, isChangesOnly() ); Value.encode( buffer, isReturnECs() ); return buffer; }
/** * Encodes the paged search control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Encode the Control envelop super.encode( buffer ); // Encode the OCTET_STRING tag buffer.put( UniversalTag.OCTET_STRING_TAG ); buffer.put( TLV.getBytes( valueLength ) ); // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE_TAG ); buffer.put( TLV.getBytes( pscSeqLength ) ); Value.encode( buffer, size ); Value.encode( buffer, cookie ); return buffer; }
/** * Encodes the gracefulShutdown extended operation. * * @return A ByteBuffer that contains the encoded PDU * @throws org.apache.directory.shared.asn1.EncoderException If anything goes wrong. */ public ByteBuffer encode() throws EncoderException { // Allocate the bytes buffer. ByteBuffer bb = ByteBuffer.allocate( computeLength() ); bb.put( UniversalTag.SEQUENCE.getValue() ); bb.put( TLV.getBytes( gracefulSequenceLength ) ); if ( timeOffline != 0 ) { Value.encode( bb, timeOffline ); } if ( delay != 0 ) { bb.put( ( byte ) GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG ); bb.put( ( byte ) Value.getNbBytes( delay ) ); bb.put( Value.getBytes( delay ) ); } return bb; }
/** * Encodes the paged search control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( pscSeqLength ) ); Value.encode( buffer, getSize() ); Value.encode( buffer, getCookie() ); return buffer; }
/** * Encodes the Subentries control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws org.apache.directory.shared.asn1.EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Now encode the Subentries specific part Value.encode( buffer, isVisible() ); return buffer; }
/** * Encodes the Subentries control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Encode the Control envelop super.encode( buffer ); // Encode the OCTET_STRING tag buffer.put( UniversalTag.OCTET_STRING_TAG ); buffer.put( TLV.getBytes( valueLength ) ); // Now encode the Subentries specific part Value.encode( buffer, visibility ); return buffer; }
/** * {@inheritDoc} */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Encode the Control envelop super.encode( buffer ); // If we have a value, encode it if ( value != null ) { Value.encode( buffer, value ); } return buffer; } }
/** * Encode the SyncDoneValue control * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong while encoding. */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Encode the SEQ buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( syncDoneValueLength ) ); if ( getCookie() != null ) { Value.encode( buffer, getCookie() ); } if ( isRefreshDeletes() ) { Value.encode( buffer, isRefreshDeletes() ); } return buffer; }