org.openflow.protocol.vendor
Class OFByteArrayVendorData

java.lang.Object
  extended by org.openflow.protocol.vendor.OFByteArrayVendorData
All Implemented Interfaces:
OFVendorData

public class OFByteArrayVendorData
extends java.lang.Object
implements OFVendorData

Basic implementation of OFVendorData that just treats the data as a byte array. This is used if there's an OFVendor message where there's no registered OFVendorId or no specific OFVendorDataType that can be determined from the data.

Author:
Rob Vaterlaus (rob.vaterlaus@bigswitch.com)

Field Summary
protected  byte[] bytes
           
 
Constructor Summary
OFByteArrayVendorData()
          Construct vendor data with an empty byte array.
OFByteArrayVendorData(byte[] bytes)
          Construct vendor data with the specified byte array.
 
Method Summary
 byte[] getBytes()
          Get the associated byte array for this vendor data.
 int getLength()
          Get the length of the vendor data.
 void readFrom(java.nio.ByteBuffer data, int length)
          Read the vendor data from the ByteBuffer into the byte array.
 void setBytes(byte[] bytes)
          Set the byte array for the vendor data.
 void writeTo(java.nio.ByteBuffer data)
          Write the vendor data bytes to the ByteBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytes

protected byte[] bytes
Constructor Detail

OFByteArrayVendorData

public OFByteArrayVendorData()
Construct vendor data with an empty byte array.


OFByteArrayVendorData

public OFByteArrayVendorData(byte[] bytes)
Construct vendor data with the specified byte array.

Parameters:
bytes -
Method Detail

getBytes

public byte[] getBytes()
Get the associated byte array for this vendor data.

Returns:
the byte array containing the raw vendor data.

setBytes

public void setBytes(byte[] bytes)
Set the byte array for the vendor data.

Parameters:
bytes - the raw byte array containing the vendor data.

getLength

public int getLength()
Get the length of the vendor data. In this case it's just then length of the underlying byte array.

Specified by:
getLength in interface OFVendorData
Returns:
the length of the vendor data

readFrom

public void readFrom(java.nio.ByteBuffer data,
                     int length)
Read the vendor data from the ByteBuffer into the byte array.

Specified by:
readFrom in interface OFVendorData
Parameters:
data - the channel buffer from which we're deserializing
length - the length to the end of the enclosing message

writeTo

public void writeTo(java.nio.ByteBuffer data)
Write the vendor data bytes to the ByteBuffer

Specified by:
writeTo in interface OFVendorData
Parameters:
data - the channel buffer to which we're serializing