/** * Compute the SyncStateValue length. * <br> * SyncStateValue : * <pre> * 0x30 L1 * | * +--> 0x0A 0x01 [0x00|0x01|0x02|0x03] (type) * [+--> 0x04 L2 abcd... (entryUUID) * [+--> 0x04 L3 abcd... (cookie) * </pre> * * @return The computed length */ @Override public int computeLength() { // The sync state type length syncStateSeqLength = 1 + 1 + 1; syncStateSeqLength += 1 + TLV.getNbBytes( getEntryUUID().length ) + getEntryUUID().length; // The cookie length, if we have a cookie if ( getCookie() != null ) { syncStateSeqLength += 1 + TLV.getNbBytes( getCookie().length ) + getCookie().length; } valueLength = 1 + TLV.getNbBytes( syncStateSeqLength ) + syncStateSeqLength; return valueLength; }
/** * Compute the SyncStateValue length. * <br> * SyncStateValue : * <pre> * 0x30 L1 * | * +--> 0x0A 0x01 [0x00|0x01|0x02|0x03] (type) * [+--> 0x04 L2 abcd... (entryUUID) * [+--> 0x04 L3 abcd... (cookie) * </pre> * * @return The computed length */ @Override public int computeLength() { // The sync state type length syncStateSeqLength = 1 + 1 + 1; syncStateSeqLength += 1 + TLV.getNbBytes( getEntryUUID().length ) + getEntryUUID().length; // The cookie length, if we have a cookie if ( getCookie() != null ) { syncStateSeqLength += 1 + TLV.getNbBytes( getCookie().length ) + getCookie().length; } valueLength = 1 + TLV.getNbBytes( syncStateSeqLength ) + syncStateSeqLength; return valueLength; }
/** * Compute the SyncStateValue length. * <br> * SyncStateValue : * <pre> * 0x30 L1 * | * +--> 0x0A 0x01 [0x00|0x01|0x02|0x03] (type) * [+--> 0x04 L2 abcd... (entryUUID) * [+--> 0x04 L3 abcd... (cookie) * </pre> * * @return The computed length */ @Override public int computeLength() { // The sync state type length syncStateSeqLength = 1 + 1 + 1; syncStateSeqLength += 1 + TLV.getNbBytes( getEntryUUID().length ) + getEntryUUID().length; // The cookie length, if we have a cookie if ( getCookie() != null ) { syncStateSeqLength += 1 + TLV.getNbBytes( getCookie().length ) + getCookie().length; } valueLength = 1 + TLV.getNbBytes( syncStateSeqLength ) + syncStateSeqLength; return valueLength; }
/** * Encode the SyncStateValue control * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ @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( syncStateSeqLength ) ); // The mode buffer.put( UniversalTag.ENUMERATED.getValue() ); buffer.put( ( byte ) 0x01 ); buffer.put( BerValue.getBytes( getSyncStateType().getValue() ) ); // the entryUUID BerValue.encode( buffer, getEntryUUID() ); // The cookie if ( getCookie() != null ) { BerValue.encode( buffer, getCookie() ); } return buffer; }
/** * Encode the SyncStateValue control * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ @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( syncStateSeqLength ) ); // The mode buffer.put( UniversalTag.ENUMERATED.getValue() ); buffer.put( ( byte ) 0x01 ); buffer.put( BerValue.getBytes( getSyncStateType().getValue() ) ); // the entryUUID BerValue.encode( buffer, getEntryUUID() ); // The cookie if ( getCookie() != null ) { BerValue.encode( buffer, getCookie() ); } return buffer; }
/** * Encode the SyncStateValue control * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ @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( syncStateSeqLength ) ); // The mode buffer.put( UniversalTag.ENUMERATED.getValue() ); buffer.put( ( byte ) 0x01 ); buffer.put( BerValue.getBytes( getSyncStateType().getValue() ) ); // the entryUUID BerValue.encode( buffer, getEntryUUID() ); // The cookie if ( getCookie() != null ) { BerValue.encode( buffer, getCookie() ); } return buffer; }