eu.reservoir.monitoring.distribution
Class MeasurementEncoder

java.lang.Object
  extended by eu.reservoir.monitoring.distribution.MeasurementEncoder
Direct Known Subclasses:
MeasurementEncoderWithNames

public class MeasurementEncoder
extends java.lang.Object

Convert a measurement to a byte array.


Constructor Summary
MeasurementEncoder(Measurement m)
          Construct a MeasurementEncoder for a Measurement.
 
Method Summary
 void encode(java.io.DataOutput out)
          Encode the Measurement to a DataOutput object.
protected  void encodeType(ProbeAttributeType type)
          Encode a type
protected  void encodeValue(java.lang.Object value, ProbeAttributeType type)
          Encode a value of a given type
protected  void writeInt(java.lang.Object value)
          Write an integer to the output.
protected  void writeList(java.lang.Object value)
          Write a list to the output.
protected  void writeTable(java.lang.Object value)
          Write a table to the output.
protected  void writeUTF(java.lang.Object value)
          Write a UTF string to the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MeasurementEncoder

public MeasurementEncoder(Measurement m)
Construct a MeasurementEncoder for a Measurement.

Method Detail

encode

public void encode(java.io.DataOutput out)
            throws java.io.IOException,
                   TypeException
Encode the Measurement to a DataOutput object. The message is encoded and it's structure is:
 +------------------------------------------------------------------------+
 | seq no (long) | options (byte) [bit 0 : 0 = no names / 1 = with names] |
 +------------------------------------------------------------------------+
 |  probe id (long) | type (utf string)  | timestamp (long)               |
 +------------------------------------------------------------------------+
 | time delta (long) | service id (long) | group id (long) | attr count   |
 +------------------------------------------------------------------------+
 | attr0 field no (int) | attr0 type (byte) | attr0 value (depends)       |
 +------------------------------------------------------------------------+
 | ....                                                                   |
 +------------------------------------------------------------------------+
 | attrN field no (int) | attrN type (byte) | attrN value (depends)       |
 +------------------------------------------------------------------------+
 

Throws:
java.io.IOException
TypeException

encodeType

protected void encodeType(ProbeAttributeType type)
                   throws java.io.IOException
Encode a type

Throws:
java.io.IOException

encodeValue

protected void encodeValue(java.lang.Object value,
                           ProbeAttributeType type)
                    throws java.io.IOException
Encode a value of a given type

Throws:
java.io.IOException

writeInt

protected void writeInt(java.lang.Object value)
                 throws java.io.IOException
Write an integer to the output.

Throws:
java.io.IOException

writeUTF

protected void writeUTF(java.lang.Object value)
                 throws java.io.IOException
Write a UTF string to the output.

Throws:
java.io.IOException

writeTable

protected void writeTable(java.lang.Object value)
                   throws java.io.IOException
Write a table to the output.

Throws:
java.io.IOException

writeList

protected void writeList(java.lang.Object value)
                  throws java.io.IOException
Write a list to the output.

Throws:
java.io.IOException


RESERVOIR Monitoring 0.6.4