/** * {@inheritDoc} */ @Override public CodecControl<SyncDoneValue> newCodecControl() { return new SyncDoneValueDecorator( codec ); }
/** * Compute the syncDoneValue length. * <pre> * 0x30 L1 * | * +--> 0x04 L2 xkcd!!!... (cookie) * +--> 0x01 0x01 [0x00|0xFF] (refreshDeletes) * </pre> * * @return The computed length */ @Override public int computeLength() { // cookie's length if ( getCookie() != null ) { syncDoneValueLength = 1 + TLV.getNbBytes( getCookie().length ) + getCookie().length; } // the refreshDeletes flag length if ( isRefreshDeletes() ) { syncDoneValueLength += 1 + 1 + 1; } valueLength = 1 + TLV.getNbBytes( syncDoneValueLength ) + syncDoneValueLength; // Call the super class to compute the global control length return valueLength; }
/** * {@inheritDoc} */ @Override public boolean isRefreshDeletes() { return getDecorated().isRefreshDeletes(); }
computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); buffer.put( TLV.getBytes( syncDoneValueLength ) ); if ( getCookie() != null ) BerValue.encode( buffer, getCookie() ); if ( isRefreshDeletes() ) BerValue.encode( buffer, isRefreshDeletes() );
/** * {@inheritDoc} */ @Override public Asn1Object decode( byte[] controlBytes ) throws DecoderException { ByteBuffer bb = ByteBuffer.wrap( controlBytes ); SyncDoneValueContainer container = new SyncDoneValueContainer( getCodecService(), this ); DECODER.decode( bb, container ); return this; } }
computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); buffer.put( TLV.getBytes( syncDoneValueLength ) ); if ( getCookie() != null ) BerValue.encode( buffer, getCookie() ); if ( isRefreshDeletes() ) BerValue.encode( buffer, isRefreshDeletes() );
/** * {@inheritDoc} */ @Override public Asn1Object decode( byte[] controlBytes ) throws DecoderException { ByteBuffer bb = ByteBuffer.wrap( controlBytes ); SyncDoneValueContainer container = new SyncDoneValueContainer( getCodecService(), this ); DECODER.decode( bb, container ); return this; } }
/** * {@inheritDoc} */ @Override public CodecControl<SyncDoneValue> newCodecControl() { return new SyncDoneValueDecorator( codec ); }
computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); buffer.put( TLV.getBytes( syncDoneValueLength ) ); if ( getCookie() != null ) BerValue.encode( buffer, getCookie() ); if ( isRefreshDeletes() ) BerValue.encode( buffer, isRefreshDeletes() );
/** * Compute the syncDoneValue length. * <pre> * 0x30 L1 * | * +--> 0x04 L2 xkcd!!!... (cookie) * +--> 0x01 0x01 [0x00|0xFF] (refreshDeletes) * </pre> * * @return The computed length */ @Override public int computeLength() { // cookie's length if ( getCookie() != null ) { syncDoneValueLength = 1 + TLV.getNbBytes( getCookie().length ) + getCookie().length; } // the refreshDeletes flag length if ( isRefreshDeletes() ) { syncDoneValueLength += 1 + 1 + 1; } valueLength = 1 + TLV.getNbBytes( syncDoneValueLength ) + syncDoneValueLength; // Call the super class to compute the global control length return valueLength; }
/** * {@inheritDoc} */ @Override public byte[] getCookie() { return getDecorated().getCookie(); }
/** * {@inheritDoc} */ @Override public Asn1Object decode( byte[] controlBytes ) throws DecoderException { ByteBuffer bb = ByteBuffer.wrap( controlBytes ); SyncDoneValueContainer container = new SyncDoneValueContainer( getCodecService(), this ); DECODER.decode( bb, container ); return this; } }
/** * {@inheritDoc} */ @Override public CodecControl<SyncDoneValue> newCodecControl( SyncDoneValue control ) { return new SyncDoneValueDecorator( codec, control ); } }
/** * Compute the syncDoneValue length. * <pre> * 0x30 L1 * | * +--> 0x04 L2 xkcd!!!... (cookie) * +--> 0x01 0x01 [0x00|0xFF] (refreshDeletes) * </pre> * * @return The computed length */ @Override public int computeLength() { // cookie's length if ( getCookie() != null ) { syncDoneValueLength = 1 + TLV.getNbBytes( getCookie().length ) + getCookie().length; } // the refreshDeletes flag length if ( isRefreshDeletes() ) { syncDoneValueLength += 1 + 1 + 1; } valueLength = 1 + TLV.getNbBytes( syncDoneValueLength ) + syncDoneValueLength; // Call the super class to compute the global control length return valueLength; }
/** * {@inheritDoc} */ @Override public boolean isRefreshDeletes() { return getDecorated().isRefreshDeletes(); }
/** * {@inheritDoc} */ @Override public CodecControl<SyncDoneValue> newCodecControl( SyncDoneValue control ) { return new SyncDoneValueDecorator( codec, control ); } }
/** * 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_08000_CANNOT_PUT_A_PDU_IN_NULL_BUFFER ) ); } // Encode the SEQ buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( syncDoneValueLength ) ); if ( getCookie() != null ) { BerValue.encode( buffer, getCookie() ); } if ( isRefreshDeletes() ) { BerValue.encode( buffer, isRefreshDeletes() ); } return buffer; }
/** * {@inheritDoc} */ @Override public void setRefreshDeletes( boolean refreshDeletes ) { getDecorated().setRefreshDeletes( refreshDeletes ); }
/** * {@inheritDoc} */ @Override public CodecControl<SyncDoneValue> newCodecControl() { return new SyncDoneValueDecorator( codec ); }
/** * 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_08000_CANNOT_PUT_A_PDU_IN_NULL_BUFFER ) ); } // Encode the SEQ buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( syncDoneValueLength ) ); if ( getCookie() != null ) { BerValue.encode( buffer, getCookie() ); } if ( isRefreshDeletes() ) { BerValue.encode( buffer, isRefreshDeletes() ); } return buffer; }