public class TlvBuilder extends java.lang.Object implements TlvBuild
| Modifier and Type | Field and Description |
|---|---|
static int |
END_OF_BYTE_ARRAY_INDEX |
static int |
MAX_TLV_LENGTH |
static byte |
TLV_LENGTH_POS_OFFSET |
static byte |
TLV_ONE_BYTE_LENGTH |
static byte |
TLV_TYPE_LENGTH_OVERHEAD |
static byte |
TLV_TYPE_OVERHEAD |
bTlvBuilder, miiTypeBytelength| Constructor and Description |
|---|
TlvBuilder() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(ConfigurationFileImport cfi) |
void |
add(HexString hsObject)
This method assumes that each Type is of 1 byte Length
|
void |
add(int iTlvType,
byte[] bValue)
Method add.
|
void |
add(int iTlvType,
byte[] bValue,
boolean booleanStripExistingTlv) |
void |
add(int iTlvType,
HexString hsValue) |
void |
add(int iTlvType,
java.lang.Integer iValue) |
void |
add(int iSnmpTlvType,
org.snmp4j.smi.OID oObjectID,
byte bBerDataType,
byte[] bValue) |
void |
add(int iSnmpTlvType,
org.snmp4j.smi.OID oObjectID,
byte bBerDataType,
long lNumber) |
void |
add(int iSnmpTlvType,
org.snmp4j.smi.OID oObjectID,
byte bBerDataType,
java.lang.String sValue) |
void |
add(TlvBuilder tbObject) |
void |
add(TlvVariableBinding tvbObject)
This option is used when TLVs are greater than 1 byte Length or a length of 254 bytes
|
void |
clear() |
TlvBuilder |
clone() |
java.util.List<java.lang.String> |
cloneTlvBuffer() |
static byte[] |
coupleMultipleTopLevelTlvValues(TlvBuilder tbTLV)
This method take a multiple single byte length TLV, strip the TopLevel TLV byte and length and concatenate all the values
|
void |
encapsulateTlv(int iTlvType) |
static byte[] |
encapsulateTlv(int iTlvType,
byte[] baValue) |
void |
encapsulateTlv(int iTlvType,
int iLength) |
static byte[] |
fetchTlv(java.util.List<java.lang.Integer> liType,
byte[] bTlvByteArray) |
static byte[] |
fetchTlv(java.util.List<java.lang.Integer> liType,
java.util.Map<java.lang.Integer,java.lang.Integer> _miiTypeByteLength,
byte[] bTlvByteArray)
If a Type to Byte Length is not defined, this method assumes that the type is of 1 byte Length
|
static byte[] |
findTLVIndex(byte[] bTlvBuffer,
byte[] bParentChildTlvEncodeList) |
static byte[] |
findTLVIndex(byte[] bTlvBuffer,
byte[] bParentChildTlvEncodeList,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeByteLength) |
static int |
findTLVIndex(byte[] bTlvBuffer,
int iType) |
HexString |
getHexString() |
java.util.Map<java.lang.Integer,java.lang.Integer> |
getMapTypeToByteLength()
Method getMapTypeToByteLength.
|
static java.util.List<byte[]> |
getTlvHexByType(byte[] bTLV)
This method assumes all TopLevel TLV are 1 Byte Length
|
static java.util.List<byte[]> |
getTlvHexByType(byte[] bTLV,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength) |
static int |
getTlvLength(byte[] bTlvBuffer,
int iInitalPosition,
int iByteLength) |
static byte[] |
getTlvValue(byte[] bTlvBuffer) |
static byte[] |
getTlvValue(byte[] bTlvBuffer,
int iInitalPosition) |
static byte[] |
getTlvValue(byte[] bTlvBuffer,
int iInitalPosition,
int iByteLength) |
java.util.List<java.lang.Integer> |
getTopLevelTlvList()
Method getTopLevelTlvList.
|
java.util.List<java.lang.Integer> |
getTopLevelTlvList(java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeByteLength)
Method getTopLevelTlvList.
|
java.lang.Boolean |
isEmpty()
Method isEmpty.
|
boolean |
isTLVConstruct() |
static boolean |
isTLVConstruct(byte[] bTLV,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTlvTypeTpByteLength) |
int |
length() |
static int |
nextTLVIndex(byte[] bTlvBuffer,
int iInitalPosition) |
static int |
nextTLVIndex(byte[] bTlvBuffer,
int iInitalPosition,
int iByteLength) |
static TlvBuilder |
reorderTLV(boolean booDirection,
TlvBuilder tb) |
java.util.List<byte[]> |
sortByTopLevelTlv() |
java.util.List<byte[]> |
sortByTopLevelTlv(java.util.Map<java.lang.Integer,java.lang.Integer> miiTopLevelTLVByteLength)
Unless specified in the Map, this method assumes each TopLevel is 1 byte of length
|
static byte[] |
stripTlv(int iType,
byte[] bTlvByteArray)
This method assumes each type has a 1 byte length encoding
|
static byte[] |
stripTlv(int iType,
byte[] bTlvByteArray,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength) |
static byte[] |
stripZeroByteTLV(byte[] bTlvByteArray,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength)
This method will remove any TLV that contain a Zero Byte Length
|
static java.lang.String |
tlvDump(byte[] ba) |
byte[] |
toByteArray()
Method toByteArray.
|
static java.util.List<HexString> |
topLevelTlvToHexStringList(byte[] baTlv,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength) |
java.lang.String |
toString() |
java.lang.String |
toStringArray() |
java.lang.String |
toStringSeperation(java.lang.String sSeperation) |
public static final byte TLV_LENGTH_POS_OFFSET
public static final byte TLV_TYPE_OVERHEAD
public static final byte TLV_TYPE_LENGTH_OVERHEAD
public static final int MAX_TLV_LENGTH
public static final int END_OF_BYTE_ARRAY_INDEX
public static final byte TLV_ONE_BYTE_LENGTH
public void add(ConfigurationFileImport cfi)
cfi - public void add(HexString hsObject) throws TlvException
hsObject - TlvExceptionpublic void add(int iTlvType,
java.lang.Integer iValue)
throws TlvException
iTlvType - iValue - TlvExceptionpublic void add(int iTlvType,
HexString hsValue)
throws TlvException
iTlvType - hsValue - TlvExceptionpublic void add(TlvBuilder tbObject)
tbObject - public static TlvBuilder reorderTLV(boolean booDirection, TlvBuilder tb) throws TlvException
booDirection - tb - TlvExceptionpublic void add(int iTlvType,
byte[] bValue)
throws TlvException
TlvBuildadd in interface TlvBuildiTlvType - bValue - TlvException - * @see com.comcast.oscar.tlv.TlvBuild#add(int, byte[])public void add(int iTlvType,
byte[] bValue,
boolean booleanStripExistingTlv)
throws TlvException
iTlvType - bValue - booleanStripExistingTlv - = True = Strip Existing TLV ; False = Do Not Strip TLVTlvExceptionpublic void add(int iSnmpTlvType,
org.snmp4j.smi.OID oObjectID,
byte bBerDataType,
long lNumber)
iSnmpTlvType - oObjectID - bBerDataType - lNumber - public void add(int iSnmpTlvType,
org.snmp4j.smi.OID oObjectID,
byte bBerDataType,
java.lang.String sValue)
iSnmpTlvType - oObjectID - bBerDataType - sValue - public void add(int iSnmpTlvType,
org.snmp4j.smi.OID oObjectID,
byte bBerDataType,
byte[] bValue)
iSnmpTlvType - oObjectID - bBerDataType - bValue - public void add(TlvVariableBinding tvbObject)
tvbObject - public java.lang.String toStringArray()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringSeperation(java.lang.String sSeperation)
sSeperation - public int length()
public void encapsulateTlv(int iTlvType)
throws TlvException
iTlvType - TlvExceptionpublic void encapsulateTlv(int iTlvType,
int iLength)
throws TlvException
iTlvType - iLength - TlvExceptionpublic void clear()
clear in interface TlvBuildTlvBuild.clear()public byte[] toByteArray()
TlvBuildtoByteArray in interface TlvBuildpublic java.util.List<java.lang.Integer> getTopLevelTlvList()
TlvBuildgetTopLevelTlvList in interface TlvBuildpublic java.util.List<java.lang.Integer> getTopLevelTlvList(java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeByteLength)
TlvBuildgetTopLevelTlvList in interface TlvBuildmiiTypeByteLength - com.comcast.oscar.tlv.TlvBuild#getTopLevelTlvList(Map) public java.util.List<java.lang.String> cloneTlvBuffer()
public TlvBuilder clone()
clone in class java.lang.Objectpublic java.util.List<byte[]> sortByTopLevelTlv()
public java.util.List<byte[]> sortByTopLevelTlv(java.util.Map<java.lang.Integer,java.lang.Integer> miiTopLevelTLVByteLength)
miiTopLevelTLVByteLength - public java.util.Map<java.lang.Integer,java.lang.Integer> getMapTypeToByteLength()
TlvBuildgetMapTypeToByteLength in interface TlvBuildTlvBuild.getMapTypeToByteLength()public java.lang.Boolean isEmpty()
TlvBuildisEmpty in interface TlvBuildTlvBuild.isEmpty()public HexString getHexString()
public static java.util.List<HexString> topLevelTlvToHexStringList(byte[] baTlv, java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength)
baTlv - miiTypeToByteLength - public static byte[] stripTlv(int iType,
byte[] bTlvByteArray)
throws TlvException
iType - bTlvByteArray - TlvExceptionpublic static byte[] stripTlv(int iType,
byte[] bTlvByteArray,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength)
throws TlvException
iType - bTlvByteArray - miiTypeToByteLength - TlvExceptionpublic static byte[] fetchTlv(java.util.List<java.lang.Integer> liType,
byte[] bTlvByteArray)
liType - bTlvByteArray - public static byte[] fetchTlv(java.util.List<java.lang.Integer> liType,
java.util.Map<java.lang.Integer,java.lang.Integer> _miiTypeByteLength,
byte[] bTlvByteArray)
liType - bTlvByteArray - _miiTypeByteLength - Mappublic static int nextTLVIndex(byte[] bTlvBuffer,
int iInitalPosition)
throws TlvException
bTlvBuffer - iInitalPosition - TlvExceptionpublic static int nextTLVIndex(byte[] bTlvBuffer,
int iInitalPosition,
int iByteLength)
throws TlvException
bTlvBuffer - iInitalPosition - iByteLength - TlvExceptionpublic static byte[] findTLVIndex(byte[] bTlvBuffer,
byte[] bParentChildTlvEncodeList)
throws TlvException
bTlvBuffer - bParentChildTlvEncodeList - TlvExceptionpublic static int findTLVIndex(byte[] bTlvBuffer,
int iType)
throws TlvException
bTlvBuffer - iType - TlvExceptionpublic static byte[] findTLVIndex(byte[] bTlvBuffer,
byte[] bParentChildTlvEncodeList,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeByteLength)
throws TlvException
bTlvBuffer - bParentChildTlvEncodeList - miiTypeByteLength - TlvExceptionpublic static byte[] getTlvValue(byte[] bTlvBuffer)
throws TlvException
bTlvBuffer - TlvExceptionpublic static byte[] getTlvValue(byte[] bTlvBuffer,
int iInitalPosition)
throws TlvException
bTlvBuffer - iInitalPosition - TlvExceptionpublic static byte[] getTlvValue(byte[] bTlvBuffer,
int iInitalPosition,
int iByteLength)
throws TlvException
bTlvBuffer - iInitalPosition - iByteLength - TlvExceptionpublic static int getTlvLength(byte[] bTlvBuffer,
int iInitalPosition,
int iByteLength)
throws TlvException
bTlvBuffer - iInitalPosition - iByteLength - TlvExceptionpublic static byte[] coupleMultipleTopLevelTlvValues(TlvBuilder tbTLV)
tbTLV - public static java.util.List<byte[]> getTlvHexByType(byte[] bTLV)
throws TlvException
bTLV - TlvExceptionpublic static java.util.List<byte[]> getTlvHexByType(byte[] bTLV,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength)
throws TlvException
bTLV - miiTypeToByteLength - TlvExceptionpublic boolean isTLVConstruct()
public static boolean isTLVConstruct(byte[] bTLV,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTlvTypeTpByteLength)
bTLV - miiTlvTypeTpByteLength - public static byte[] encapsulateTlv(int iTlvType,
byte[] baValue)
throws TlvException
iTlvType - baValue - TlvExceptionpublic static byte[] stripZeroByteTLV(byte[] bTlvByteArray,
java.util.Map<java.lang.Integer,java.lang.Integer> miiTypeToByteLength)
throws TlvException
bTlvByteArray - miiTypeToByteLength - MapTlvExceptionpublic static java.lang.String tlvDump(byte[] ba)
ba -