net.kano.joscar.tlv
Interface MutableTlvChain

All Superinterfaces:
LiveWritable, TlvChain, Writable
All Known Implementing Classes:
DefaultMutableTlvChain

public interface MutableTlvChain
extends TlvChain, Writable

Provides an interface for a TLV chain whose contents can be modified.


Method Summary
 void addAll(TlvChain other)
          Adds all TLV's in the given chain to the end of this chain (preserving order).
 void addTlv(Tlv tlv)
          Adds the given TLV to this chain.
 void removeTlv(Tlv tlv)
          Removes the given TLV from the chain, if it is present.
 void removeTlvs(int type)
          Removes all TLV's in this chain of the given TLV type.
 void removeTlvs(int[] types)
          Removes all TLV's in this chain having any of the given types.
 void replaceAll(TlvChain other)
          Deletes all TLV's currently in this chain having the same type as any of the TLV's in the other chain, and replaces them with their counterparts in the given chain.
 void replaceTlv(Tlv tlv)
          Removes all TLV's of the given type from the chain, and inserts the given TLV at the index of the first TLV removed, or at the end of the chain if no TLV's of the same type were found.
 
Methods inherited from interface TlvChain
getFirstTlv, getLastTlv, getString, getString, getTlvCount, getTlvs, getTlvs, getTotalSize, getUInt, getUShort, hasTlv, iterator
 
Methods inherited from interface net.kano.joscar.Writable
getWritableLength, write
 

Method Detail

addTlv

public void addTlv(Tlv tlv)
Adds the given TLV to this chain.

Parameters:
tlv - the TLV to add

replaceTlv

public void replaceTlv(Tlv tlv)
Removes all TLV's of the given type from the chain, and inserts the given TLV at the index of the first TLV removed, or at the end of the chain if no TLV's of the same type were found.

Parameters:
tlv - the TLV to replace its "siblings" of the same TLV type

removeTlv

public void removeTlv(Tlv tlv)
Removes the given TLV from the chain, if it is present.

Parameters:
tlv - the TLV to remove

removeTlvs

public void removeTlvs(int type)
Removes all TLV's in this chain of the given TLV type.

Parameters:
type - the type of TLV of which to remove all instances

removeTlvs

public void removeTlvs(int[] types)
Removes all TLV's in this chain having any of the given types.

Parameters:
types - the TLV types of which to remove all instances

addAll

public void addAll(TlvChain other)
Adds all TLV's in the given chain to the end of this chain (preserving order).

Parameters:
other - the chain whose TLV's will be appended to this chain

replaceAll

public void replaceAll(TlvChain other)
Deletes all TLV's currently in this chain having the same type as any of the TLV's in the other chain, and replaces them with their counterparts in the given chain. Behavior is undefined if the given chain contains two or more TLV's of the same type. Any TLV's in the given chain without counterparts in this chain will be appended to the end of this chain.

Parameters:
other - the TLV whose TLV's will replace and/or add to TLV's in this chain