com.ibm.diameter.packet
Class AvpValueUtil

java.lang.Object
  extended by com.ibm.diameter.packet.AvpValueUtil
Direct Known Subclasses:
AvpValueUtilGrouped, AvpValueUtilOctetString, AvpValueUtilUnknown, AvpValueUtilUnsigned32, AvpValueUtilUnsigned64, AvpValueUtilUTF8String

public class AvpValueUtil
extends java.lang.Object

Class that defines the methods used to read and write AVP values and also to retrieve the value and the length of the value from the Avp object.

This class is primarily used as an interface for extensions with specific data types.


Constructor Summary
AvpValueUtil()
           
 
Method Summary
 java.lang.Object getValue()
          Returns the AVP data.
 void getValueFromByteArray(byte[] in, int offset, int valueLength)
          Populates the AVP data field by reading the appropriate number of bytes from the supplied byte[]
 void getValueFromByteBuffer(com.ibm.wsspi.buffermgmt.WsByteBuffer in, int valueLength)
          Populates the AVP data field by reading the appropriate number of bytes from the WsByteBuffer
 void getValueFromByteBufferStream(com.ibm.diameter.util.DiamWsByteBufferInputStream in, int valueLength)
          Populates the AVP data field by reading the appropriate number of bytes from the supplied DiamWsByteBufferInputStream
 void getValueFromStream(java.io.DataInputStream in, int valueLength)
          Populates the AVP data field by reading the appropriate number of bytes from the DataInputStream
 int getValueLength()
          Returns the length of the AVP data field in octets.
 void writeValueToByteBufferStream(com.ibm.diameter.util.DiamWsByteBufferOutputStream out)
          Writes the AVP data field to the DiamWsByteBufferInputStream
 void writeValueToStream(java.io.DataOutputStream out)
          Writes the AVP data field to the DataOutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvpValueUtil

public AvpValueUtil()
Method Detail

getValue

public java.lang.Object getValue()
Returns the AVP data.

Returns:
The AVP data. This must be cast to the appropriate data type.

getValueLength

public int getValueLength()
Returns the length of the AVP data field in octets. Note that the length does not include any of the AVP header fields. It only applies to the length of the Avp data.

Returns:
length of the AVP data field

getValueFromByteArray

public void getValueFromByteArray(byte[] in,
                                  int offset,
                                  int valueLength)
                           throws com.ibm.diameter.packet.exception.DataOutOfSyncException,
                                  java.io.IOException,
                                  java.io.EOFException
Populates the AVP data field by reading the appropriate number of bytes from the supplied byte[]

Parameters:
in - The byte[] that contains the AVP data.
offset - The position in the byte[] to be begin reading at
valueLength - The number of bytes to read from the byte[]
Throws:
com.ibm.diameter.packet.exception.DataOutOfSyncException
java.io.IOException
java.io.EOFException

getValueFromByteBuffer

public void getValueFromByteBuffer(com.ibm.wsspi.buffermgmt.WsByteBuffer in,
                                   int valueLength)
                            throws com.ibm.diameter.packet.exception.DataOutOfSyncException,
                                   java.io.IOException,
                                   java.io.EOFException
Populates the AVP data field by reading the appropriate number of bytes from the WsByteBuffer

Parameters:
in - The WsByteBuffer that contains the AVP data.
valueLength - The number of bytes to read from the WsByteBuffer
Throws:
com.ibm.diameter.packet.exception.DataOutOfSyncException
java.io.IOException
java.io.EOFException

getValueFromByteBufferStream

public void getValueFromByteBufferStream(com.ibm.diameter.util.DiamWsByteBufferInputStream in,
                                         int valueLength)
                                  throws com.ibm.diameter.packet.exception.DataOutOfSyncException,
                                         java.io.IOException,
                                         java.io.EOFException
Populates the AVP data field by reading the appropriate number of bytes from the supplied DiamWsByteBufferInputStream

Parameters:
in - The DiamWsByteBufferInputStream that contains the AVP data.
valueLength - The number of bytes to read from the DiamWsByteBufferInputStream
Throws:
com.ibm.diameter.packet.exception.DataOutOfSyncException
java.io.IOException
java.io.EOFException

writeValueToByteBufferStream

public void writeValueToByteBufferStream(com.ibm.diameter.util.DiamWsByteBufferOutputStream out)
                                  throws java.io.IOException
Writes the AVP data field to the DiamWsByteBufferInputStream

Parameters:
out - The DiamWsByteBufferInputStream to write to
Throws:
java.io.IOException

getValueFromStream

public void getValueFromStream(java.io.DataInputStream in,
                               int valueLength)
                        throws com.ibm.diameter.packet.exception.DataOutOfSyncException,
                               java.io.IOException,
                               java.io.EOFException
Populates the AVP data field by reading the appropriate number of bytes from the DataInputStream

Parameters:
in - The DataInputStream that contains the AVP data.
valueLength - The number of bytes to read from the DataInputStream
Throws:
com.ibm.diameter.packet.exception.DataOutOfSyncException
java.io.IOException
java.io.EOFException

writeValueToStream

public void writeValueToStream(java.io.DataOutputStream out)
                        throws java.io.IOException
Writes the AVP data field to the DataOutputStream

Parameters:
out - The DataOutputStream to write to
Throws:
java.io.IOException


Copyright © 2006 IBM Corp. All Rights Reserved.